From a62640d8a50430a679219b502e274a7828e933ec Mon Sep 17 00:00:00 2001 From: Shanin Roman <40040452+Erigara@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:29:27 +0300 Subject: [PATCH] fix(sumeragi): remove expired transaction from cache (#4922) Signed-off-by: Shanin Roman --- core/src/gossiper.rs | 6 +++--- core/src/queue.rs | 2 +- core/src/sumeragi/main_loop.rs | 4 ++-- core/src/tx.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/gossiper.rs b/core/src/gossiper.rs index 4a08606108e..70c1bc73b17 100644 --- a/core/src/gossiper.rs +++ b/core/src/gossiper.rs @@ -119,16 +119,16 @@ impl TransactionGossiper { tx, err: crate::queue::Error::InBlockchain, }) => { - iroha_logger::debug!(tx_payload_hash = %tx.as_ref().hash(), "Transaction already in blockchain, ignoring...") + iroha_logger::debug!(tx = %tx.as_ref().hash(), "Transaction already in blockchain, ignoring...") } Err(crate::queue::Failure { tx, err: crate::queue::Error::IsInQueue, }) => { - iroha_logger::trace!(tx_payload_hash = %tx.as_ref().hash(), "Transaction already in the queue, ignoring...") + iroha_logger::trace!(tx = %tx.as_ref().hash(), "Transaction already in the queue, ignoring...") } Err(crate::queue::Failure { tx, err }) => { - iroha_logger::error!(?err, tx_payload_hash = %tx.as_ref().hash(), "Failed to enqueue transaction.") + iroha_logger::error!(?err, tx = %tx.as_ref().hash(), "Failed to enqueue transaction.") } }, Err(err) => iroha_logger::error!(%err, "Transaction rejected"), diff --git a/core/src/queue.rs b/core/src/queue.rs index 26639e15378..eb6aa3ec32f 100644 --- a/core/src/queue.rs +++ b/core/src/queue.rs @@ -177,7 +177,7 @@ impl Queue { /// # Errors /// See [`enum@Error`] pub fn push(&self, tx: AcceptedTransaction, state_view: &StateView) -> Result<(), Failure> { - trace!(?tx, "Pushing to the queue"); + trace!(tx=%tx.as_ref().hash(), "Pushing to the queue"); if let Err(err) = self.check_tx(&tx, state_view) { return Err(Failure { tx, err }); } diff --git a/core/src/sumeragi/main_loop.rs b/core/src/sumeragi/main_loop.rs index d6e34172fed..3ccc6d172d0 100644 --- a/core/src/sumeragi/main_loop.rs +++ b/core/src/sumeragi/main_loop.rs @@ -1024,9 +1024,9 @@ pub(crate) fn run( .retain(|tx| { let expired = sumeragi.queue.is_expired(tx); if expired { - debug!(?tx, "Transaction expired") + debug!(tx=%tx.as_ref().hash(), "Transaction expired") } - expired + !expired }); sumeragi.queue.get_transactions_for_block( diff --git a/core/src/tx.rs b/core/src/tx.rs index 2b841f7bba2..ead5ce71213 100644 --- a/core/src/tx.rs +++ b/core/src/tx.rs @@ -229,7 +229,7 @@ impl TransactionExecutor { )); } - debug!("Validating transaction: {:?}", tx); + debug!(tx=%tx.as_ref().hash(), "Validating transaction"); Self::validate_with_runtime_executor(tx.clone(), state_transaction)?; if let (authority, Executable::Wasm(bytes)) = tx.into() {