From bf7d50feb14ece7da96976dffe6293cd72300046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Thu, 27 Feb 2025 16:29:36 +0000 Subject: [PATCH] Sends both instructions of process_close_program() in a single transaction. --- cli/src/program_v4.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cli/src/program_v4.rs b/cli/src/program_v4.rs index c33c2e16e645ba..d2caf7db92c449 100644 --- a/cli/src/program_v4.rs +++ b/cli/src/program_v4.rs @@ -850,16 +850,14 @@ fn process_close_program( let retract_instruction = build_retract_instruction(&program_account, program_address, &authority_pubkey)?; - let mut initial_messages = if let Some(instruction) = retract_instruction { - vec![message(vec![instruction])?] - } else { - vec![] - }; - + let mut instructions = Vec::default(); + if let Some(retract_instruction) = retract_instruction { + instructions.push(retract_instruction); + } let set_program_length_instruction = instruction::set_program_length(program_address, &authority_pubkey, 0, &payer_pubkey); - - initial_messages.push(message(vec![set_program_length_instruction])?); + instructions.push(set_program_length_instruction); + let initial_messages = [message(instructions)?]; check_payer(rpc_client.clone(), config, 0, &initial_messages, &[], &[])?;