aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.cpp
diff options
context:
space:
mode:
authorchinggg <24590067+chinggg@users.noreply.github.com>2022-07-23 20:51:07 +0800
committerchinggg <24590067+chinggg@users.noreply.github.com>2022-07-28 14:39:45 +0800
commitb4b657ba57a2ce31b3c21ea9245aad26d5b06a57 (patch)
tree8fb1b9db0e88fda2087ed13b34450ac22bce6565 /src/txorphanage.cpp
parent194f6dc43ccc330a8a4607be3a2b8935490d6db0 (diff)
downloadbitcoin-b4b657ba57a2ce31b3c21ea9245aad26d5b06a57.tar.xz
refactor: log `nEvicted` message in `LimitOrphans` then return void
`LimitOrphans()` can log expired tx and it should log evicted tx as well instead of returning the number for caller to print the message. Since `LimitOrphans()` now return void, the redundant assertion check in fuzz test is also removed.
Diffstat (limited to 'src/txorphanage.cpp')
-rw-r--r--src/txorphanage.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index ed4783f1a5..69ae8ea582 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -102,7 +102,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer);
}
-unsigned int TxOrphanage::LimitOrphans(unsigned int max_orphans)
+void TxOrphanage::LimitOrphans(unsigned int max_orphans)
{
AssertLockHeld(g_cs_orphans);
@@ -135,7 +135,7 @@ unsigned int TxOrphanage::LimitOrphans(unsigned int max_orphans)
EraseTx(m_orphan_list[randompos]->first);
++nEvicted;
}
- return nEvicted;
+ if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted);
}
void TxOrphanage::AddChildrenToWorkSet(const CTransaction& tx, std::set<uint256>& orphan_work_set) const