Don't use stale executor cache (bp #13966) (#13969)

* Don't use stale executor cache (#13966)


(cherry picked from commit 882d033233)

* fix conflicts

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2020-12-09 09:11:31 +00:00
committed by GitHub
parent fb9f35d2f0
commit a46d14a2d7
11 changed files with 382 additions and 18 deletions

View File

@@ -0,0 +1,32 @@
//! @brief Invokes an instruction and returns an error, the instruction invoked
//! uses the instruction data provided and all the accounts
use solana_program::{
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, instruction::AccountMeta,
instruction::Instruction, program::invoke, pubkey::Pubkey,
};
entrypoint!(process_instruction);
fn process_instruction(
_program_id: &Pubkey,
accounts: &[AccountInfo],
instruction_data: &[u8],
) -> ProgramResult {
let to_call = accounts[0].key;
let infos = accounts;
let instruction = Instruction {
accounts: accounts[1..]
.iter()
.map(|acc| AccountMeta {
pubkey: *acc.key,
is_signer: acc.is_signer,
is_writable: acc.is_writable,
})
.collect(),
data: instruction_data.to_owned(),
program_id: *to_call,
};
let _ = invoke(&instruction, &infos);
Err(42.into())
}