Skip to content

Commit

Permalink
Use config commitment for balance checks (solana-labs#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots authored Nov 14, 2020
1 parent c4ec3b3 commit 6ee1f09
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions token/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ fn new_throwaway_signer() -> (Option<Box<dyn Signer>>, Option<Pubkey>) {
}

fn check_fee_payer_balance(config: &Config, required_balance: u64) -> Result<(), Error> {
let balance = config.rpc_client.get_balance(&config.fee_payer)?;
let balance = config
.rpc_client
.get_balance_with_commitment(&config.fee_payer, config.commitment_config)?
.value;
if balance < required_balance {
Err(format!(
"Fee payer, {}, has insufficient balance: {} required, {} available",
Expand All @@ -178,7 +181,10 @@ fn check_fee_payer_balance(config: &Config, required_balance: u64) -> Result<(),
}

fn check_owner_balance(config: &Config, required_balance: u64) -> Result<(), Error> {
let balance = config.rpc_client.get_balance(&config.owner)?;
let balance = config
.rpc_client
.get_balance_with_commitment(&config.owner, config.commitment_config)?
.value;
if balance < required_balance {
Err(format!(
"Owner, {}, has insufficient balance: {} required, {} available",
Expand Down

0 comments on commit 6ee1f09

Please sign in to comment.