Skip to content

Commit edb97bb

Browse files
committed
[logging] add logs for inner loop of LimitOrphans
1 parent 8a58d0e commit edb97bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/node/txorphanage.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,21 @@ void TxOrphanageImpl::LimitOrphans()
494494
// The number of inner loop iterations is bounded by the total number of announcements.
495495
const auto& dos_threshold = heap_peer_dos.empty() ? FeeFrac{1, 1} : heap_peer_dos.front().second;
496496
auto it_ann = m_orphans.get<ByPeer>().lower_bound(ByPeerView{worst_peer, false, 0});
497+
unsigned int num_erased_this_round{0};
498+
unsigned int starting_num_ann{it_worst_peer->second.m_count_announcements};
497499
while (NeedsTrim()) {
498500
if (!Assume(it_ann->m_announcer == worst_peer)) break;
499501
if (!Assume(it_ann != m_orphans.get<ByPeer>().end())) break;
500502

501503
Erase<ByPeer>(it_ann++);
502504
num_erased += 1;
505+
num_erased_this_round += 1;
503506

504507
// If we erased the last orphan from this peer, it_worst_peer will be invalidated.
505508
it_worst_peer = m_peer_orphanage_info.find(worst_peer);
506509
if (it_worst_peer == m_peer_orphanage_info.end() || it_worst_peer->second.GetDosScore(max_ann, max_mem) <= dos_threshold) break;
507510
}
511+
LogDebug(BCLog::TXPACKAGES, "peer=%d orphanage overflow, removed %u of %u announcements\n", worst_peer, num_erased_this_round, starting_num_ann);
508512

509513
if (!NeedsTrim()) break;
510514

0 commit comments

Comments
 (0)