mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: integrate NodeTypesWithDB (#10698)
Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com>
This commit is contained in:
@ -12,6 +12,8 @@ reth-db.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-rpc-types.workspace = true
|
||||
reth-node-ethereum.workspace = true
|
||||
reth-node-types.workspace = true
|
||||
|
||||
|
||||
eyre.workspace = true
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
use reth_node_ethereum::EthereumNode;
|
||||
use reth_node_types::NodeTypesWithDBAdapter;
|
||||
use reth_primitives::{Address, B256};
|
||||
use reth_provider::{
|
||||
providers::StaticFileProvider, AccountReader, BlockReader, BlockSource, HeaderProvider,
|
||||
@ -21,12 +23,13 @@ fn main() -> eyre::Result<()> {
|
||||
// Instantiate a provider factory for Ethereum mainnet using the provided DB.
|
||||
// TODO: Should the DB version include the spec so that you do not need to specify it here?
|
||||
let spec = ChainSpecBuilder::mainnet().build();
|
||||
let factory = ProviderFactory::new_with_database_path(
|
||||
db_path,
|
||||
spec.into(),
|
||||
Default::default(),
|
||||
StaticFileProvider::read_only(db_path.join("static_files"))?,
|
||||
)?;
|
||||
let factory =
|
||||
ProviderFactory::<NodeTypesWithDBAdapter<EthereumNode, _>>::new_with_database_path(
|
||||
db_path,
|
||||
spec.into(),
|
||||
Default::default(),
|
||||
StaticFileProvider::read_only(db_path.join("static_files"))?,
|
||||
)?;
|
||||
|
||||
// This call opens a RO transaction on the database. To write to the DB you'd need to call
|
||||
// the `provider_rw` function and look for the `Writer` variants of the traits.
|
||||
|
||||
Reference in New Issue
Block a user