Try multiple times to confirm a non-zero balance

This commit is contained in:
Michael Vines 2018-08-03 14:23:20 -07:00
parent c998199954
commit 1a9e6ffdd7
1 changed files with 9 additions and 3 deletions

View File

@ -105,9 +105,15 @@ fn main() -> () {
)
});
let balance = client.poll_get_balance(&leader_pubkey).unwrap();
eprintln!("new balance is {}", balance);
assert!(balance > 0);
// Try multiple times to confirm a non-zero balance. |poll_get_balance| currently times
// out after 1 second, and sometimes this is not enough time while the network is
// booting
let balance_ok = (0..30).any(|i| {
let balance = client.poll_get_balance(&leader_pubkey).unwrap();
eprintln!("new balance is {} (attempt #{})", balance, i);
balance > 0
});
assert!(balance_ok, "0 balance, airdrop failed?");
}
fullnode.join().expect("join");