From 07336e3e43d1d5e0506640f896e2dc3a547d7b06 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 14 Apr 2021 01:45:12 +0000 Subject: [PATCH] Fix account copy step in program test message processor (#16469) (#16471) (cherry picked from commit 278c125d990418521772d24daa0eef76e4a88616) Co-authored-by: Justin Starry --- program-test/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/program-test/src/lib.rs b/program-test/src/lib.rs index c6861ffc11..1b619b09cd 100644 --- a/program-test/src/lib.rs +++ b/program-test/src/lib.rs @@ -303,13 +303,13 @@ impl program_stubs::SyscallStubs for SyscallStubs { .map_err(|err| ProgramError::try_from(err).unwrap_or_else(|err| panic!("{}", err)))?; // Copy writeable account modifications back into the caller's AccountInfos - for (i, instruction_account) in instruction.accounts.iter().enumerate() { - if !instruction_account.is_writable { + for (i, account_pubkey) in message.account_keys.iter().enumerate() { + if !message.is_writable(i) { continue; } for account_info in account_infos { - if *account_info.unsigned_key() == instruction_account.pubkey { + if account_info.unsigned_key() == account_pubkey { let account = &accounts[i]; **account_info.try_borrow_mut_lamports().unwrap() = account.borrow().lamports;