From babebeee66bdb0270e5b56c51cd1cc626e56fd75 Mon Sep 17 00:00:00 2001 From: Bushstar Date: Fri, 29 Sep 2023 05:47:23 +0100 Subject: [PATCH] Do not use iter after deletion. Fix compiler warning. --- src/txmempool.cpp | 2 +- src/txmempool.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 006214bdd1..72e030fcee 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -414,6 +414,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { const auto& tx = it->GetTx(); + const auto txType = it->GetCustomTxType(); NotifyEntryRemoved(it->GetSharedTx(), reason); const uint256 hash = tx.GetHash(); for (const CTxIn& txin : tx.vin) @@ -434,7 +435,6 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) mapLinks.erase(it); mapTx.erase(it); - const auto txType = it->GetCustomTxType(); if (txType == CustomTxType::EvmTx || txType == CustomTxType::TransferDomain) { auto found{false}; EvmAddressData sender{}; diff --git a/src/txmempool.h b/src/txmempool.h index b44ba0b348..eaa4f03ba5 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -572,7 +572,7 @@ class CTxMemPool indexed_transaction_set mapTx GUARDED_BY(cs); std::map> evmTxsBySender; - std::map evmReplaceByFeeBySender; + std::map evmReplaceByFeeBySender; using txiter = indexed_transaction_set::nth_index<0>::type::const_iterator; std::vector> vTxHashes GUARDED_BY(cs); //!< All tx witness hashes/entries in mapTx, in random order