Pass executable_accounts into with_subset()

This commit is contained in:
Greg Fitzgerald
2018-11-26 21:42:51 -07:00
parent ec0a56cb9c
commit 1ac7536286

View File

@ -712,7 +712,7 @@ impl Bank {
/// for the borrow checker to track them with regards to the original set. /// for the borrow checker to track them with regards to the original set.
fn with_subset<F, A>(accounts: &mut [Account], ixes: &[u8], func: F) -> A fn with_subset<F, A>(accounts: &mut [Account], ixes: &[u8], func: F) -> A
where where
F: Fn(&mut [&mut Account]) -> A, F: FnOnce(&mut [&mut Account]) -> A,
{ {
let mut subset: Vec<&mut Account> = ixes let mut subset: Vec<&mut Account> = ixes
.iter() .iter()
@ -770,8 +770,8 @@ impl Bank {
) -> Result<()> { ) -> Result<()> {
for (instruction_index, instruction) in tx.instructions.iter().enumerate() { for (instruction_index, instruction) in tx.instructions.iter().enumerate() {
let program_id = tx.program_id(instruction_index); let program_id = tx.program_id(instruction_index);
Self::with_subset(tx_accounts, &instruction.accounts, |program_accounts| {
let mut executable_accounts = self.load_executable_accounts(*program_id)?; let mut executable_accounts = self.load_executable_accounts(*program_id)?;
Self::with_subset(tx_accounts, &instruction.accounts, |program_accounts| {
runtime::execute_instruction( runtime::execute_instruction(
tx, tx,
instruction_index, instruction_index,