@@ -33,12 +33,15 @@ use reth_provider::{
33
33
ProviderFactory , StateProvider , TryIntoHistoricalStateProvider ,
34
34
} ;
35
35
mod reth_db_layer;
36
- use reth_db_layer:: RethDBLayer ;
36
+ use reth_db_layer:: RethDbLayer ;
37
37
38
38
#[ tokio:: main]
39
39
async fn main ( ) -> Result < ( ) > {
40
40
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.
42
45
let reth = Reth :: new ( )
43
46
. dev ( )
44
47
. disable_discovery ( )
@@ -53,7 +56,7 @@ async fn main() -> Result<()> {
53
56
// Any RPC method that is not implemented in the RethDbProvider gracefully falls back to the
54
57
// RPC provider specified in the `on_http` method.
55
58
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 ( ) ) ;
57
60
58
61
// Initialize the RPC provider to compare the time taken to fetch the results.
59
62
let rpc_provider = ProviderBuilder :: new ( ) . on_http ( reth. endpoint_url ( ) ) ;
@@ -92,7 +95,7 @@ async fn main() -> Result<()> {
92
95
}
93
96
94
97
/// 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
96
99
where
97
100
P : Provider < T > ,
98
101
T : Transport + Clone ,
0 commit comments