Skip to content

Commit

Permalink
cli: Stop topping up buffer balance (#20181)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored Sep 29, 2021
1 parent c02ef39 commit 53a810d
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2037,24 +2037,24 @@ fn complete_partial_program_init(
if account.owner != *loader_id {
instructions.push(system_instruction::assign(elf_pubkey, loader_id));
}
}
if account.lamports < minimum_balance {
let balance = minimum_balance - account.lamports;
instructions.push(system_instruction::transfer(
payer_pubkey,
elf_pubkey,
balance,
));
balance_needed = balance;
} else if account.lamports > minimum_balance
&& system_program::check_id(&account.owner)
&& !allow_excessive_balance
{
return Err(format!(
"Buffer account has a balance: {:?}; it may already be in use",
Sol(account.lamports)
)
.into());
if account.lamports < minimum_balance {
let balance = minimum_balance - account.lamports;
instructions.push(system_instruction::transfer(
payer_pubkey,
elf_pubkey,
balance,
));
balance_needed = balance;
} else if account.lamports > minimum_balance
&& system_program::check_id(&account.owner)
&& !allow_excessive_balance
{
return Err(format!(
"Buffer account has a balance: {:?}; it may already be in use",
Sol(account.lamports)
)
.into());
}
}
Ok((instructions, balance_needed))
}
Expand Down

0 comments on commit 53a810d

Please sign in to comment.