Skip to content

Commit 561b00a

Browse files
sdaftuarlaanwj
authored andcommitted
[addrman] Improve tried table collision logging
Github-Pull: bitcoin#15486 Rebased-From: 4d83401 Tree-SHA512: c7843191c470d8b3298d4375632ddbcfd26358d21100bcbffa8d40498782f9dfef08cfb7b3c040525ef912b27ddd593322b60f8f21e16e2ae9bae66433ce807e
1 parent f810f14 commit 561b00a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/addrman.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ void CAddrMan::Good_(const CService& addr, bool test_before_evict, int64_t nTime
239239

240240
// Will moving this address into tried evict another entry?
241241
if (test_before_evict && (vvTried[tried_bucket][tried_bucket_pos] != -1)) {
242-
LogPrint(BCLog::ADDRMAN, "Collision inserting element into tried table, moving %s to m_tried_collisions=%d\n", addr.ToString(), m_tried_collisions.size());
242+
// Output the entry we'd be colliding with, for debugging purposes
243+
auto colliding_entry = mapInfo.find(vvTried[tried_bucket][tried_bucket_pos]);
244+
LogPrint(BCLog::ADDRMAN, "Collision inserting element into tried table (%s), moving %s to m_tried_collisions=%d\n", colliding_entry != mapInfo.end() ? colliding_entry->second.ToString() : "", addr.ToString(), m_tried_collisions.size());
243245
if (m_tried_collisions.size() < ADDRMAN_SET_TRIED_COLLISION_SIZE) {
244246
m_tried_collisions.insert(nId);
245247
}

0 commit comments

Comments
 (0)