diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp index 1263985068de2..6fa1408d0faf6 100644 --- a/src/txorphanage.cpp +++ b/src/txorphanage.cpp @@ -52,10 +52,10 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer) int TxOrphanage::EraseTx(const Wtxid& wtxid) { - return EraseTxNoLock(wtxid); + return EraseTxInternal(wtxid); } -int TxOrphanage::EraseTxNoLock(const Wtxid& wtxid) +int TxOrphanage::EraseTxInternal(const Wtxid& wtxid) { std::map::iterator it = m_orphans.find(wtxid); if (it == m_orphans.end()) @@ -101,7 +101,7 @@ void TxOrphanage::EraseForPeer(NodeId peer) // increment to avoid iterator becoming invalid after erasure const auto& [wtxid, orphan] = *iter++; if (orphan.fromPeer == peer) { - nErased += EraseTxNoLock(wtxid); + nErased += EraseTxInternal(wtxid); } } if (nErased > 0) LogPrint(BCLog::TXPACKAGES, "Erased %d orphan transaction(s) from peer=%d\n", nErased, peer); @@ -121,7 +121,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans, FastRandomContext& rng) { std::map::iterator maybeErase = iter++; if (maybeErase->second.nTimeExpire <= nNow) { - nErased += EraseTxNoLock(maybeErase->second.tx->GetWitnessHash()); + nErased += EraseTxInternal(maybeErase->second.tx->GetWitnessHash()); } else { nMinExpTime = std::min(maybeErase->second.nTimeExpire, nMinExpTime); } @@ -134,7 +134,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans, FastRandomContext& rng) { // Evict a random orphan: size_t randompos = rng.randrange(m_orphan_list.size()); - EraseTxNoLock(m_orphan_list[randompos]->second.tx->GetWitnessHash()); + EraseTxInternal(m_orphan_list[randompos]->second.tx->GetWitnessHash()); ++nEvicted; } if (nEvicted > 0) LogPrint(BCLog::TXPACKAGES, "orphanage overflow, removed %u tx\n", nEvicted); @@ -213,7 +213,7 @@ void TxOrphanage::EraseForBlock(const CBlock& block) if (vOrphanErase.size()) { int nErased = 0; for (const auto& orphanHash : vOrphanErase) { - nErased += EraseTxNoLock(orphanHash); + nErased += EraseTxInternal(orphanHash); } LogPrint(BCLog::TXPACKAGES, "Erased %d orphan transaction(s) included or conflicted by block\n", nErased); } diff --git a/src/txorphanage.h b/src/txorphanage.h index 7b2de7d420d19..8d81adb0ad37e 100644 --- a/src/txorphanage.h +++ b/src/txorphanage.h @@ -99,7 +99,7 @@ class TxOrphanage { std::vector m_orphan_list; /** Erase an orphan by wtxid */ - int EraseTxNoLock(const Wtxid& wtxid); + int EraseTxInternal(const Wtxid& wtxid); }; #endif // BITCOIN_TXORPHANAGE_H