From a31e242043a8440cbd72d469bc1cef44dbf7015d Mon Sep 17 00:00:00 2001 From: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:14:39 +0200 Subject: [PATCH] fatp: update_view: error handling simplified --- .../src/fork_aware_txpool/fork_aware_txpool.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs b/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs index 01e704369f19..22af769beb95 100644 --- a/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs +++ b/substrate/client/transaction-pool/src/fork_aware_txpool/fork_aware_txpool.rs @@ -1012,17 +1012,11 @@ where match error { // We need to install listener for stale xt: in case of // transaction being already included in the block we want to - // send InBlock + Finalized event. - // The same applies for TemporarilyBanned / AlreadyImported. We - // need to create listener. + // send InBlock event using view's pool's watcher. Ok( - Error::InvalidTransaction(InvalidTransaction::Stale) | - Error::TemporarilyBanned | - Error::AlreadyImported(_), + Error::InvalidTransaction(InvalidTransaction::Stale) ) => Ok(view.create_watcher(tx_hash)), - Ok( - Error::InvalidTransaction(_), - ) => Err((error.expect("already in Ok arm. qed."), tx_hash, tx.tx())), + Ok(_) => Err((error.expect("already in Ok arm. qed."), tx_hash, tx.tx())), _ => { log::debug!(target: LOG_TARGET, "[{:?}] txpool: update_view: something went wrong: {error:?}", tx_hash); Err(( @@ -1068,7 +1062,7 @@ where if self.view_store.is_empty() { for result in results { match result { - Err((Error::InvalidTransaction(_), tx_hash, _)) => { + Err((_, tx_hash, _)) => { self.view_store.listener.invalidate_transactions(vec![tx_hash]); self.mempool.remove_watched(tx_hash); },