Add program_ids() methods

Added CompiledInstruction::program_id() so that we don't need to pass
around instruction indexes just for Message::program_id().

Also added Message.program_ids() that returns a slice so that we
can move those pubkeys into Message::account_keys.
This commit is contained in:
Greg Fitzgerald
2019-04-02 16:02:57 -06:00
parent 025b4f90de
commit 4c0bc1fd88
6 changed files with 31 additions and 25 deletions

View File

@@ -707,11 +707,11 @@ impl AccountsDB {
.instructions
.iter()
.map(|ix| {
if message.program_ids.len() <= ix.program_ids_index as usize {
if message.program_ids().len() <= ix.program_ids_index as usize {
error_counters.account_not_found += 1;
return Err(TransactionError::AccountNotFound);
}
let program_id = message.program_ids[ix.program_ids_index as usize];
let program_id = message.program_ids()[ix.program_ids_index as usize];
self.load_executable_accounts(fork, &program_id, error_counters)
})
.collect()