Skip to content

Commit a12c7db

Browse files
committedOct 3, 2024·
nit
1 parent 4c3a783 commit a12c7db

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed
 

‎examples/advanced/examples/reth_db_layer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use std::path::PathBuf;
55

66
/// We use the tower-like layering functionality that has been baked into the alloy-provider to
77
/// intercept the requests and redirect to the `RethDbProvider`.
8-
pub(crate) struct RethDBLayer {
8+
pub(crate) struct RethDbLayer {
99
db_path: PathBuf,
1010
}
1111

1212
/// Initialize the `RethDBLayer` with the path to the reth datadir.
13-
impl RethDBLayer {
13+
impl RethDbLayer {
1414
pub(crate) const fn new(db_path: PathBuf) -> Self {
1515
Self { db_path }
1616
}

‎examples/advanced/examples/reth_db_provider.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ use reth_provider::{
3333
ProviderFactory, StateProvider, TryIntoHistoricalStateProvider,
3434
};
3535
mod reth_db_layer;
36-
use reth_db_layer::RethDBLayer;
36+
use reth_db_layer::RethDbLayer;
3737

3838
#[tokio::main]
3939
async fn main() -> Result<()> {
4040
run_with_tempdir("provider-call-reth-db", |data_dir| async move {
41-
// Initialize reth node with a specific data directory
41+
// Initializing reth with a tmp data directory.
42+
// We use a tmp directory for the purposes of this example.
43+
// This would actually use an existing reth datadir specified by `--datadir` when starting
44+
// your reth node.
4245
let reth = Reth::new()
4346
.dev()
4447
.disable_discovery()
@@ -53,7 +56,7 @@ async fn main() -> Result<()> {
5356
// Any RPC method that is not implemented in the RethDbProvider gracefully falls back to the
5457
// RPC provider specified in the `on_http` method.
5558
let provider =
56-
ProviderBuilder::new().layer(RethDBLayer::new(db_path)).on_http(reth.endpoint_url());
59+
ProviderBuilder::new().layer(RethDbLayer::new(db_path)).on_http(reth.endpoint_url());
5760

5861
// Initialize the RPC provider to compare the time taken to fetch the results.
5962
let rpc_provider = ProviderBuilder::new().on_http(reth.endpoint_url());
@@ -92,7 +95,7 @@ async fn main() -> Result<()> {
9295
}
9396

9497
/// Implement the `ProviderLayer` trait for the `RethDBLayer` struct.
95-
impl<P, T> ProviderLayer<P, T> for RethDBLayer
98+
impl<P, T> ProviderLayer<P, T> for RethDbLayer
9699
where
97100
P: Provider<T>,
98101
T: Transport + Clone,

0 commit comments

Comments
 (0)
Please sign in to comment.