From 53a810dbadabdd8bbbb389b4f755f4aa4e661ed7 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 29 Sep 2021 12:27:18 -0400 Subject: [PATCH] cli: Stop topping up buffer balance (#20181) --- cli/src/program.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/cli/src/program.rs b/cli/src/program.rs index 91dfc1028b..7333687256 100644 --- a/cli/src/program.rs +++ b/cli/src/program.rs @@ -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)) }