From edb97bb3f151600f00c94a2732d2595446011295 Mon Sep 17 00:00:00 2001 From: glozow Date: Tue, 15 Jul 2025 16:24:20 -0400 Subject: [PATCH] [logging] add logs for inner loop of LimitOrphans --- src/node/txorphanage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/txorphanage.cpp b/src/node/txorphanage.cpp index 3e07652abcc..e15de3a3365 100644 --- a/src/node/txorphanage.cpp +++ b/src/node/txorphanage.cpp @@ -494,17 +494,21 @@ void TxOrphanageImpl::LimitOrphans() // The number of inner loop iterations is bounded by the total number of announcements. const auto& dos_threshold = heap_peer_dos.empty() ? FeeFrac{1, 1} : heap_peer_dos.front().second; auto it_ann = m_orphans.get().lower_bound(ByPeerView{worst_peer, false, 0}); + unsigned int num_erased_this_round{0}; + unsigned int starting_num_ann{it_worst_peer->second.m_count_announcements}; while (NeedsTrim()) { if (!Assume(it_ann->m_announcer == worst_peer)) break; if (!Assume(it_ann != m_orphans.get().end())) break; Erase(it_ann++); num_erased += 1; + num_erased_this_round += 1; // If we erased the last orphan from this peer, it_worst_peer will be invalidated. it_worst_peer = m_peer_orphanage_info.find(worst_peer); if (it_worst_peer == m_peer_orphanage_info.end() || it_worst_peer->second.GetDosScore(max_ann, max_mem) <= dos_threshold) break; } + LogDebug(BCLog::TXPACKAGES, "peer=%d orphanage overflow, removed %u of %u announcements\n", worst_peer, num_erased_this_round, starting_num_ann); if (!NeedsTrim()) break;