@@ -28,6 +28,7 @@ use shared::balance::TokenSupply;
2828use shared:: block:: Block ;
2929use shared:: block_result:: BlockResult ;
3030use shared:: checksums:: Checksums ;
31+ use shared:: client:: Client ;
3132use shared:: crawler:: crawl;
3233use shared:: crawler_state:: ChainCrawlerState ;
3334use shared:: error:: {
@@ -39,7 +40,6 @@ use shared::token::Token;
3940use shared:: utils:: BalanceChange ;
4041use shared:: validator:: ValidatorSet ;
4142use tendermint_rpc:: HttpClient ;
42- use tendermint_rpc:: client:: CompatMode ;
4343use tendermint_rpc:: endpoint:: block:: Response as TendermintBlockResponse ;
4444use tokio:: sync:: Mutex ;
4545use tokio:: time:: Instant ;
@@ -50,13 +50,9 @@ use tokio_retry::strategy::{ExponentialBackoff, jitter};
5050async fn main ( ) -> Result < ( ) , MainError > {
5151 let config = AppConfig :: parse ( ) ;
5252
53- let client =
54- HttpClient :: builder ( config. tendermint_url . as_str ( ) . parse ( ) . unwrap ( ) )
55- . compat_mode ( CompatMode :: V0_37 )
56- . build ( )
57- . unwrap ( ) ;
53+ let client = Client :: new ( & config. tendermint_url ) ;
5854
59- let chain_id = tendermint_service:: query_status ( & client)
55+ let chain_id = tendermint_service:: query_status ( client. as_ref ( ) )
6056 . await
6157 . into_rpc_error ( ) ?
6258 . node_info
@@ -65,12 +61,11 @@ async fn main() -> Result<(), MainError> {
6561
6662 tracing:: info!( "Network chain id: {}" , chain_id) ;
6763
68- let checksums = Arc :: new ( Mutex :: new ( query_checksums ( & client) . await ) ) ;
64+ let checksums =
65+ Arc :: new ( Mutex :: new ( query_checksums ( client. as_ref ( ) ) . await ) ) ;
6966
7067 config. log . init ( ) ;
7168
72- let client = Arc :: new ( client) ;
73-
7469 let app_state = AppState :: new ( config. database_url ) . into_db_error ( ) ?;
7570 let conn = Arc :: new ( app_state. get_db_connection ( ) . await . into_db_error ( ) ?) ;
7671
@@ -83,7 +78,7 @@ async fn main() -> Result<(), MainError> {
8378 rlimit:: increase_nofile_limit ( 10240 ) . unwrap ( ) ;
8479 rlimit:: increase_nofile_limit ( u64:: MAX ) . unwrap ( ) ;
8580
86- let last_block_height = namada_service:: get_last_block ( & client)
81+ let last_block_height = namada_service:: get_last_block ( client. as_ref ( ) )
8782 . await
8883 . into_rpc_error ( ) ?;
8984 let crawler_state = db_service:: try_get_chain_crawler_state ( & conn)
@@ -117,7 +112,7 @@ async fn main() -> Result<(), MainError> {
117112 // Try to run crawler_fn with the last processed block
118113 let crawl_result = crawling_fn (
119114 crawler_state. last_processed_block ,
120- client. clone ( ) ,
115+ Arc :: new ( client. get ( ) ) ,
121116 conn. clone ( ) ,
122117 checksums. clone ( ) ,
123118 true ,
@@ -179,7 +174,7 @@ async fn main() -> Result<(), MainError> {
179174 Some ( state) => {
180175 if config. reindex_bonds {
181176 let ( bonds, unbonds) =
182- query_all_bonds_and_unbonds ( & client, None , None )
177+ query_all_bonds_and_unbonds ( client. as_ref ( ) , None , None )
183178 . await
184179 . into_rpc_error ( ) ?;
185180 conn. interact ( move |conn| {
@@ -208,7 +203,7 @@ async fn main() -> Result<(), MainError> {
208203 None => {
209204 let checksums = checksums. lock ( ) . await ;
210205 initial_query (
211- & client,
206+ client. as_ref ( ) ,
212207 & conn,
213208 & checksums,
214209 config. initial_query_retry_time ,
@@ -226,7 +221,7 @@ async fn main() -> Result<(), MainError> {
226221 move |block_height| {
227222 crawling_fn (
228223 block_height,
229- client. clone ( ) ,
224+ Arc :: new ( client. get ( ) ) ,
230225 conn. clone ( ) ,
231226 checksums. clone ( ) ,
232227 config. backfill_from . is_none ( ) ,
0 commit comments