Pass the correct program_id to programs (#8630)

This commit is contained in:
Jack May
2020-03-05 10:57:35 -08:00
committed by GitHub
parent 97c5fb8141
commit 5e3ce30d02
6 changed files with 45 additions and 25 deletions

View File

@ -6,6 +6,7 @@ use solana_sdk::{
entrypoint_native,
instruction::{CompiledInstruction, InstructionError},
message::Message,
native_loader::id as native_loader_id,
pubkey::Pubkey,
system_program,
transaction::TransactionError,
@ -172,7 +173,6 @@ impl MessageProcessor {
executable_accounts: &[(Pubkey, RefCell<Account>)],
program_accounts: &[Rc<RefCell<Account>>],
) -> Result<(), InstructionError> {
let program_id = instruction.program_id(&message.account_keys);
let mut keyed_accounts = create_keyed_readonly_accounts(executable_accounts);
let mut keyed_accounts2: Vec<_> = instruction
.accounts
@ -202,12 +202,16 @@ impl MessageProcessor {
let root_program_id = keyed_accounts[0].unsigned_key();
for (id, process_instruction) in &self.instruction_processors {
if id == root_program_id {
return process_instruction(&program_id, &keyed_accounts[1..], &instruction.data);
return process_instruction(
&root_program_id,
&keyed_accounts[1..],
&instruction.data,
);
}
}
native_loader::invoke_entrypoint(
&program_id,
&native_loader_id(),
&keyed_accounts,
&instruction.data,
&self.symbol_cache,