From 978ff87b7693842da1af2926bb69e51f7f7410e8 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Tue, 2 Apr 2019 16:11:39 -0600 Subject: [PATCH] Fix potential storage bug The previous code was assuming the instruction index and the program_id index were the same. That's always true for single-instruction transactions, but not for multiples. --- core/src/storage_stage.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/storage_stage.rs b/core/src/storage_stage.rs index 11a09eb3ab..209aa0f54c 100644 --- a/core/src/storage_stage.rs +++ b/core/src/storage_stage.rs @@ -402,9 +402,10 @@ impl StorageStage { // the storage_keys with their signatures for tx in entry.transactions { let message = tx.message(); - for (i, program_id) in message.program_ids().iter().enumerate() { - if solana_storage_api::check_id(&program_id) { - match deserialize(&message.instructions[i].data) { + for instruction in &message.instructions { + let program_id = instruction.program_id(message.program_ids()); + if solana_storage_api::check_id(program_id) { + match deserialize(&instruction.data) { Ok(StorageInstruction::SubmitMiningProof { entry_height: proof_entry_height, signature,