#36208 addrman: apply time penalty in nTime check

full analysis

https://github.com/bitcoin/bitcoin/pull/36208 · mzumsande · +15/-2 in 2 files, 1 commits · labels: P2P

Goal

  • Prevent duplicate address announcements from improperly boosting an entry's multiplicity in addrman
  • Ensure gossip from multiple peers correctly accounts for time penalties during duplicate checks

Fixes an ineffective check in `AddrManImpl::AddSingle()` that was intended to prevent duplicate address announcements from increasing an entry's multiplicity in the new table. When an address is stored, its timestamp has a 2-hour penalty subtracted, which caused subsequent identical announcements to appear newer than the stored record unless the penalty is also subtracted during comparison.

Problem: When the same address gossip announcement is received from multiple peers, the node unintentionally increases the address's multiplicity up to 8 because the comparison logic fails to apply the time penalty to incoming announcements.

Category: P2P (#32 of 65)

P3 · bug fix

  • P3 because it fixes an ineffective check against duplicate peer address announcements
  • Adversaries can still bypass it by changing timestamps on repeated announcements

Fixes a clear logic bug in addrman where the duplicate-announcement check was rendered ineffective by the 2-hour gossip time penalty. It is P3 rather than higher because, as mzumsande noted, 'it doesn't change things in adversarial scenarios, since peers can just do multiple announcements with changed nTime if they want to boost their RefCount artificially.'

Membership: Touches addrman logic and address relay handling in src/addrman.cpp.

Factors: security/stability 1, bug 1, performance 0, user value 0, leverage 0

Reviewability: Ready

  • Ready for review
  • Small patch with a targeted unit test and no blockers

The patch is small, cleanly separated, includes a targeted unit test, and has no pending reviewer questions.

Author status: active

Agreement: Crickets

  • No reviews or feedback yet

No reviews or comments yet.

The PR was recently opened and has not received any reviews or concept feedback.

Review verdicts (DrahtBot): 0

Files

14 lines under test/bench/ci.

  • src/test/addrman_tests.cpp +13/-1
  • src/addrman.cpp +2/-1

Card

This PR fixes a bug in AddrManImpl::AddSingle() where gossip announcements relayed across multiple peers inflated an entry's multiplicity in the new table up to 8. Because stored entries have a 2-hour time penalty subtracted, incoming identical announcements compared as newer unless the penalty was applied to the comparison. The fix applies the penalty during the check and adds a unit test. There is currently no review activity on this PR.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T17:12, confidence high, input hash a9020e9d71de1372