addrman: apply time penalty in nTime check #36208

pull mzumsande wants to merge 1 commits into bitcoin:master from mzumsande:202609_addrman_fix changing 2 files +15 −2
  1. mzumsande commented at 3:23 PM on September 9, 2026: contributor

    There is an existing check in AddSingle() that prevents us from increasing the RefCount of an address when the same announcement is received again from a different peer, which regularly happens with gossip relay - an addr can take different routes through the network to us.

    However, the check is ineffective: when the entry was first added, its nTime was stored with a 2h time penalty applied, so addr.nTime > pinfo->nTime holds even for an identical announcement. As a result, a single announcement relayed to us by several peers could increase an address's multiplicity in the new table, up to 8.

    Fix this by applying the penalty in the comparison too, matching the nTime update check a few lines above.

    This is just a small logic bugfix, 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.

  2. addrman: apply time penalty in nTime check
    When receiving a single self-announcement of a node from
    multiple peers (via gossip relay), we don't want to
    increase the multiplicity of that address.
    Therefore, we need to take into account the time penalty
    of the check.
    5f58a43fd7
  3. DrahtBot added the label P2P on Sep 9, 2026
  4. DrahtBot commented at 3:23 PM on September 9, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36208.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

Contributors
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-21 09:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me