{
 "number": 36410,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36410",
 "title": "test: cover compact blocks far ahead of the tip",
 "author": "fametrano",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-10-02T07:15:22Z",
 "updated_at": "2026-10-20T17:50:35Z",
 "description_hash": "c27bde51c12b0511",
 "age_days": 30,
 "draft": false,
 "labels": [
  "Tests"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "de16833975f3ec98dc96120e9b6e905709453aec",
 "head_ref": "test-cmpctblock-revert-to-headers",
 "head_repo": "fametrano/bitcoin",
 "head_history": [
  {
   "t": "2026-10-06T22:14:03Z",
   "sha": "9b92dcdcf429000aa49dcc642fc5463ee5789d8b"
  },
  {
   "t": "2026-10-07T21:30:02Z",
   "sha": "f446d3b499c7a0ab2d2b24ba10440e71494aee18"
  },
  {
   "t": "2026-10-10T07:35:11Z",
   "sha": "951b1cc20fceb9091ca9956821e7f86061c3a383"
  },
  {
   "t": "2026-10-13T11:27:37Z",
   "sha": "3a4e14a159c6afc7cb0f405cc4f2e0f435309514"
  },
  {
   "t": "2026-10-20T16:47:13Z",
   "sha": "de16833975f3ec98dc96120e9b6e905709453aec"
  }
 ],
 "additions": 85,
 "deletions": 0,
 "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-10-20T16:47:13Z",
  "last_reviewer_activity": null,
  "last_reviewer": null,
  "author_silent_days": 12,
  "waiting_on_author_days": 0,
  "days_since_update": 12
 },
 "refs": {
  "mentioned": [
   34618,
   34722
  ],
  "depends_on": [],
  "fixes": [
   34618
  ],
  "linked_issues": [
   {
    "number": 34618,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "test: cmpctblock: No coverage for fRevertToHeaderProcessing in compact block message handling."
   }
  ],
  "references": [
   {
    "number": 34618,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "test: cmpctblock: No coverage for fRevertToHeaderProcessing in compact block message handling."
   },
   {
    "number": 34722,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "test: cover requested far-ahead cmpctblock getdata retry"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "This adds a test that passes on master and fails with the diff from #34618 applied, as davidgumberg asked in #34722. It covers both things that diff removes for a compact block more than two blocks ahead of the tip.\n\nIf the node already requested the block from this peer, it sends another `getdata` for the full block. Without that `getdata`, the block stays in flight from this peer and nothing requests it again until the block download timeout disconnects the peer. This check is the one shuv-amp proposed in #34722.\n\nOtherwise, from a high-bandwidth peer, the node handles the header as a headers message (`fRevertToHeaderProcessing`). Most of that work is done anyway. As 151henry151 pointed out in #34618, one part is not: protecting an outbound peer from eviction (`m_chain_sync.m_protect`). The test checks for the \"Protecting outbound peer\" debug log line.\n\nEach check fails when only its branch is disabled: `fRevertToHeaderProcessing = false` fails the protection check, and `if (false)` in place of `if (requested_block_from_this_peer)` makes the `getdata` check time out. shuv-amp first tested the two branches separately in #34618.\n\nFixes #34618.\n\n*Made with my usual tools: a computer, the Internet and an LLM. The mistakes, as usual, are all mine.*",
 "commits": [
  {
   "sha": "de16833975f3ec98dc96120e9b6e905709453aec",
   "date": "2026-10-20T16:28:06Z",
   "message": "test: cover compact blocks far ahead of the tip\n\nA compact block more than two blocks ahead of the tip is not\nreconstructed. If the node requested it from that peer, it asks for the\nfull block again. Otherwise it handles the header as a headers message\n(fRevertToHeaderProcessing). No test checked what either branch does,\nso removing both made no test fail.\n\nThe new test checks that the node sends a second getdata for a requested\nblock, and that an outbound high-bandwidth peer announcing such a block\nis protected from eviction. Only the headers path sets that protection.\n\nEach check fails if its branch in net_processing.cpp is disabled."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-06T22:14:03Z",
   "kind": "force_push",
   "who": "fametrano",
   "commit": "9b92dcdcf429000aa49dcc642fc5463ee5789d8b",
   "id": "push:9b92dcdcf429000aa49dcc642fc5463ee5789d8b"
  },
  {
   "t": "2026-10-07T21:30:02Z",
   "kind": "force_push",
   "who": "fametrano",
   "commit": "f446d3b499c7a0ab2d2b24ba10440e71494aee18",
   "id": "push:f446d3b499c7a0ab2d2b24ba10440e71494aee18"
  },
  {
   "t": "2026-10-10T07:35:11Z",
   "kind": "force_push",
   "who": "fametrano",
   "commit": "951b1cc20fceb9091ca9956821e7f86061c3a383",
   "id": "push:951b1cc20fceb9091ca9956821e7f86061c3a383"
  },
  {
   "t": "2026-10-13T11:27:37Z",
   "kind": "force_push",
   "who": "fametrano",
   "commit": "3a4e14a159c6afc7cb0f405cc4f2e0f435309514",
   "id": "push:3a4e14a159c6afc7cb0f405cc4f2e0f435309514"
  },
  {
   "t": "2026-10-20T16:47:13Z",
   "kind": "force_push",
   "who": "fametrano",
   "commit": "de16833975f3ec98dc96120e9b6e905709453aec",
   "id": "push:de16833975f3ec98dc96120e9b6e905709453aec"
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-02T07:15:25Z",
   "action": "labeled",
   "label": "Tests",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-20T13:11:44Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-20T17:50:32Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 1961,
 "text_tokens_estimate": 490,
 "changed_paths": [
  "test/functional/p2p_compactblocks_far_ahead.py",
  "test/functional/test_runner.py"
 ],
 "files": [
  {
   "path": "test/functional/p2p_compactblocks_far_ahead.py",
   "add": 84,
   "del": 0
  },
  {
   "path": "test/functional/test_runner.py",
   "add": 1,
   "del": 0
  }
 ],
 "test_lines": 85,
 "git": {
  "head": "de16833975f3ec98dc96120e9b6e905709453aec",
  "head_matches_backup": true,
  "base": "4303f3b7f0775cdbbe77faddf142e1e44fa590ca",
  "patch_id": "69d983f966bfaecb",
  "commits": [
   {
    "sha": "de16833975",
    "subject": "test: cover compact blocks far ahead of the tip",
    "files": 2,
    "add": 85,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "69d983f966bfaecb",
 "input_hash": "1ad7e34bca93626d",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}