Fund accounts with the worst-case fee

This commit is contained in:
Michael Vines
2019-06-13 16:22:57 -07:00
parent b91ad6fd96
commit 25908feef9

View File

@ -615,7 +615,7 @@ pub fn generate_and_fund_keypairs<T: Client>(
if lamports_per_account > last_keypair_balance { if lamports_per_account > last_keypair_balance {
let (_, fee_calculator) = client.get_recent_blockhash().unwrap(); let (_, fee_calculator) = client.get_recent_blockhash().unwrap();
let extra = let extra =
lamports_per_account - last_keypair_balance + fee_calculator.lamports_per_signature; lamports_per_account - last_keypair_balance + fee_calculator.max_lamports_per_signature;
let total = extra * (keypairs.len() as u64); let total = extra * (keypairs.len() as u64);
if client.get_balance(&funding_pubkey.pubkey()).unwrap_or(0) < total { if client.get_balance(&funding_pubkey.pubkey()).unwrap_or(0) < total {
airdrop_lamports(client, &drone_addr.unwrap(), funding_pubkey, total)?; airdrop_lamports(client, &drone_addr.unwrap(), funding_pubkey, total)?;
@ -626,7 +626,7 @@ pub fn generate_and_fund_keypairs<T: Client>(
funding_pubkey, funding_pubkey,
&keypairs, &keypairs,
total, total,
fee_calculator.lamports_per_signature, fee_calculator.max_lamports_per_signature,
); );
} }