File tree Expand file tree Collapse file tree
apps/src/bin/namada-client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ use namada_apps::facade::tendermint_config::net::Address as TendermintAddress;
1111use namada_apps:: facade:: tendermint_rpc:: { Client , HttpClient } ;
1212use tokio:: time:: sleep;
1313
14- const WAIT_FOR_LEDGER_SYNC : u64 = 5 ;
15-
1614pub async fn main ( ) -> Result < ( ) > {
1715 match cli:: namada_client_cli ( ) ? {
1816 cli:: NamadaClient :: WithContext ( cmd_box) => {
@@ -168,7 +166,8 @@ pub async fn main() -> Result<()> {
168166async fn wait_until_node_is_synched ( ledger_address : & TendermintAddress ) {
169167 let client = HttpClient :: new ( ledger_address. clone ( ) ) . unwrap ( ) ;
170168 let height_one = Height :: try_from ( 1_u64 ) . unwrap ( ) ;
171- let mut try_count = 0 ;
169+ let mut try_count = 0_u64 ;
170+ const MAX_TRIES : u64 = 5 ;
172171
173172 loop {
174173 let node_status = client. status ( ) . await ;
@@ -187,8 +186,17 @@ async fn wait_until_node_is_synched(ledger_address: &TendermintAddress) {
187186 ) ;
188187 safe_exit ( 1 )
189188 } else {
190- println ! ( "Waiting for node to sync..." ) ;
191- sleep ( Duration :: from_secs ( try_count. pow ( try_count) ) )
189+ println ! (
190+ " Waiting for {} ({}/{} tries)..." ,
191+ if is_at_least_height_one {
192+ "a first block"
193+ } else {
194+ "node to sync"
195+ } ,
196+ try_count + 1 ,
197+ MAX_TRIES
198+ ) ;
199+ sleep ( Duration :: from_secs ( ( try_count + 1 ) . pow ( 2 ) ) )
192200 . await ;
193201 }
194202 try_count += 1 ;
You can’t perform that action at this time.
0 commit comments