From 1b88da138f6fee4272a8030165e43d844eeb5a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Zemanovi=C4=8D?= Date: Wed, 29 Mar 2023 08:20:06 +0100 Subject: [PATCH] fixup! f085a835ece393e049040c8e163bb7eaaa5d4cf6 --- apps/src/bin/namada-client/cli.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/src/bin/namada-client/cli.rs b/apps/src/bin/namada-client/cli.rs index 266f44a2482..42081c84571 100644 --- a/apps/src/bin/namada-client/cli.rs +++ b/apps/src/bin/namada-client/cli.rs @@ -11,7 +11,6 @@ use namada_apps::facade::tendermint_rpc::{Client, HttpClient}; use tendermint::block::Height; use tokio::time::sleep; - pub async fn main() -> Result<()> { match cli::namada_client_cli()? { cli::NamadaClient::WithContext(cmd_box) => { @@ -168,6 +167,7 @@ async fn wait_until_node_is_synched(ledger_address: &TendermintAddress) { let client = HttpClient::new(ledger_address.clone()).unwrap(); let height_one = Height::try_from(1_u64).unwrap(); let mut try_count = 0_u64; + const MAX_TRIES: u64 = 5; loop { let node_status = client.status().await; @@ -186,8 +186,17 @@ async fn wait_until_node_is_synched(ledger_address: &TendermintAddress) { ); safe_exit(1) } else { - println!("Waiting for node to sync..."); - sleep(Duration::from_secs(try_count.pow(try_count as u32))) + println!( + " Waiting for {} ({}/{} tries)...", + if is_at_least_height_one { + "a first block" + } else { + "node to sync" + }, + try_count + 1, + MAX_TRIES + ); + sleep(Duration::from_secs((try_count + 1).pow(2))) .await; } try_count += 1;