From 2b77f62233625e2c708a73083fc5ae293f243331 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sat, 14 Jul 2018 16:46:20 -0700 Subject: [PATCH] Poll longer while waiting for an airdrop --- src/bin/wallet.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/bin/wallet.rs b/src/bin/wallet.rs index 34b935b71b..7e1266fa5f 100644 --- a/src/bin/wallet.rs +++ b/src/bin/wallet.rs @@ -255,9 +255,18 @@ fn process_command( ); let previous_balance = client.poll_get_balance(&config.id.pubkey())?; request_airdrop(&config.drone_addr, &config.id, tokens as u64)?; - // TODO: return airdrop Result from Drone - sleep(Duration::from_millis(100)); - let current_balance = client.poll_get_balance(&config.id.pubkey())?; + + // TODO: return airdrop Result from Drone instead of polling the + // network + let mut current_balance = previous_balance; + for _ in 0..20 { + sleep(Duration::from_millis(500)); + current_balance = client.poll_get_balance(&config.id.pubkey())?; + if previous_balance != current_balance { + break; + } + println!("."); + } println!("Your balance is: {:?}", current_balance); if current_balance - previous_balance != tokens { Err("Airdrop failed!")?;