Skip to content

Commit

Permalink
Poll longer while waiting for an airdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jul 15, 2018
1 parent e8d23c1 commit 2b77f62
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/bin/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!")?;
Expand Down

0 comments on commit 2b77f62

Please sign in to comment.