Skip to content

Commit

Permalink
fixup! f085a83
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Mar 29, 2023
1 parent b13ff6f commit 1b88da1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apps/src/bin/namada-client/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 1b88da1

Please sign in to comment.