From 6482fcebdc069d3a791b58bc5fa33beb301095e6 Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 7 Oct 2024 09:21:26 +0800 Subject: [PATCH] Fixed review comments. --- zilliqa/src/consensus.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zilliqa/src/consensus.rs b/zilliqa/src/consensus.rs index 20021e3f6d..1568fec8a2 100644 --- a/zilliqa/src/consensus.rs +++ b/zilliqa/src/consensus.rs @@ -2635,10 +2635,11 @@ impl Consensus { for (idx, tx_hash) in block.transactions.iter().enumerate() { // Prefer to insert verified txn from pool. This is faster. let txn = match self.transaction_pool.pop_transaction(*tx_hash) { - Some(txn) if txn.hash == *tx_hash => txn, + Some(txn) => txn, _ => match transactions .get(idx) - .and_then(|sig_tx| sig_tx.clone().verify().ok()) + .map(|sig_tx| sig_tx.clone().verify()) + .transpose()? { // Otherwise, recover txn from proposal. This is slower. Some(txn) if txn.hash == *tx_hash => txn, @@ -2648,7 +2649,7 @@ impl Consensus { } }, }; - verified_txns.insert(idx, txn); + verified_txns.push(txn); } let transaction_hashes = verified_txns