From 8302f58f297c99194ae58965faafaf096211a69f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 14 Feb 2021 08:15:00 +0000 Subject: [PATCH] Log if unsanitary transactions are read from blockstore (#15319) (#15321) (cherry picked from commit 0812931c386888078d0787fd8af1c7737b833f21) Co-authored-by: Tyera Eulberg --- ledger/src/blockstore.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 92040421a2..aa45305b21 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -30,6 +30,7 @@ use solana_sdk::{ genesis_config::GenesisConfig, hash::Hash, pubkey::Pubkey, + sanitize::Sanitize, signature::{Keypair, Signature, Signer}, timing::timestamp, transaction::Transaction, @@ -1707,7 +1708,18 @@ impl Blockstore { let slot_transaction_iterator = slot_entries .iter() .cloned() - .flat_map(|entry| entry.transactions); + .flat_map(|entry| entry.transactions) + .map(|transaction| { + if let Err(err) = transaction.sanitize() { + warn!( + "Blockstore::get_confirmed_block sanitize failed: {:?}, \ + slot: {:?}, \ + {:?}", + err, slot, transaction, + ); + } + transaction + }); let parent_slot_entries = self .get_slot_entries(slot_meta.parent_slot, 0) .unwrap_or_default(); @@ -1963,6 +1975,17 @@ impl Blockstore { .iter() .cloned() .flat_map(|entry| entry.transactions) + .map(|transaction| { + if let Err(err) = transaction.sanitize() { + warn!( + "Blockstore::find_transaction_in_slot sanitize failed: {:?}, \ + slot: {:?}, \ + {:?}", + err, slot, transaction, + ); + } + transaction + }) .find(|transaction| transaction.signatures[0] == signature)) }