{
 "number": 36208,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36208",
 "title": "addrman: apply time penalty in nTime check",
 "author": "mzumsande",
 "author_association": "MEMBER",
 "created_at": "2026-09-09T15:23:20Z",
 "updated_at": "2026-09-09T16:41:02Z",
 "age_days": 8,
 "draft": false,
 "labels": [
  "P2P"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "5f58a43fd7c7e9815f5f7a2252e9a8372da7af68",
 "head_ref": "202609_addrman_fix",
 "head_repo": "mzumsande/bitcoin",
 "head_history": [],
 "additions": 15,
 "deletions": 2,
 "changed_files": 2,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": []
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": []
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-09T13:33:57Z",
  "last_reviewer_activity": null,
  "last_reviewer": null,
  "author_silent_days": 8,
  "waiting_on_author_days": 0,
  "days_since_update": 7
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "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.\n\nHowever, the check is ineffective: when the entry was first added, its `nTime` was stored with a [2h time penalty](https://github.com/bitcoin/bitcoin/blob/9d4325f40316d2c81d34418dc075b235173d0cec/src/net_processing.cpp#L6044) 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.\n\nFix this by applying the penalty in the comparison too, matching the `nTime` update check a few lines above.\n\nThis 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.",
 "commits": [
  {
   "sha": "5f58a43fd7c7e9815f5f7a2252e9a8372da7af68",
   "date": "2026-09-09T13:33:57Z",
   "message": "addrman: apply time penalty in nTime check\n\nWhen receiving a single self-announcement of a node from\nmultiple peers (via gossip relay), we don't want to\nincrease the multiplicity of that address.\nTherefore, we need to take into account the time penalty\nof the check."
  }
 ],
 "timeline": [],
 "labels_log": [
  {
   "t": "2026-09-09T15:23:24Z",
   "action": "labeled",
   "label": "P2P",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 1348,
 "text_tokens_estimate": 337,
 "changed_paths": [
  "src/addrman.cpp",
  "src/test/addrman_tests.cpp"
 ],
 "files": [
  {
   "path": "src/addrman.cpp",
   "add": 2,
   "del": 1
  },
  {
   "path": "src/test/addrman_tests.cpp",
   "add": 13,
   "del": 1
  }
 ],
 "test_lines": 14,
 "git": {
  "head": "5f58a43fd7c7e9815f5f7a2252e9a8372da7af68",
  "head_matches_backup": true,
  "base": "59fd053dac83c989dcb18f6d92e0d17eb7ecb227",
  "commits": [
   {
    "sha": "5f58a43fd7",
    "subject": "addrman: apply time penalty in nTime check",
    "files": 2,
    "add": 15,
    "del": 2
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "a9020e9d71de1372",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}