{
 "number": 36328,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36328",
 "title": "p2p: Reconsider package transactions that are immediately trimmed",
 "author": "instagibbs",
 "author_association": "MEMBER",
 "created_at": "2026-09-24T16:26:50Z",
 "updated_at": "2026-10-27T23:20:13Z",
 "description_hash": "961369a713dc8be1",
 "age_days": 38,
 "draft": false,
 "labels": [
  "P2P"
 ],
 "milestone": "33.0",
 "base": "master",
 "head_sha": "3c6cd0c00ab3d81ec6c9615ed812a8976083749c",
 "head_ref": "package-trim-reconsiderable",
 "head_repo": "instagibbs/bitcoin",
 "head_history": [
  {
   "t": "2026-09-24T16:38:19Z",
   "sha": "3c6cd0c00ab3d81ec6c9615ed812a8976083749c"
  }
 ],
 "additions": 194,
 "deletions": 7,
 "changed_files": 3,
 "commit_count": 4,
 "size_bucket": "M",
 "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-28T16:12:19Z",
  "last_reviewer_activity": null,
  "last_reviewer": null,
  "author_silent_days": 34,
  "waiting_on_author_days": 0,
  "days_since_update": 5
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "In-master, if a package is entered into mempool at the lowerst chunk feerate, pushing the mempool oversize, this causes that transaction (package) to be trimmed immediately. This is fine and expected, but the returned validation result `TX_MEMPOOL_POLICY` precludes the now-evicted parent from being considered again (i.e. fetched / processed as package) until after another block is found.\n\nThis is not a major issue, but would result in unneeded censorship of someone low-balling package feerates.\n\nThe already-in-mempool case needs a bit more logic due to the `FeeFailure`'s requirement of package feerate knowledge, so I opted to use the \"would have used\" value even though it was never directly submitted in the same-txid-different-wtxid case. **Alternatively**, we could simply get rid of the `FeeFailure` value as IIUC it's not used in non-testing code. This may be a larger code change but could make the resulting code more maintainable going forward. This could also be future work.\n\nRelated to finding made by Loupe, and subsequently Red Team.",
 "commits": [
  {
   "sha": "47c9070b9de0823e946ef4d226dd3dc41685cac9",
   "date": "2026-09-24T15:57:48Z",
   "message": "validation: make package transactions trimmed after submission reconsiderable\n\nA transaction evicted by LimitMempoolSize() right after being accepted\nby itself is TX_RECONSIDERABLE: a package with a higher feerate may\nstill get it in. Transactions submitted together as a package and\nevicted by the final trim in AcceptPackage() were TX_MEMPOOL_POLICY\ninstead, as that code predates TX_RECONSIDERABLE.\n\nFor 1p1c relay this put an evicted parent and child in the reject\nfilter until the next block, so a new child could not bump the parent\nback in."
  },
  {
   "sha": "7235f027188bd289aa81ff98ecd2353346216db7",
   "date": "2026-09-24T15:57:48Z",
   "message": "test: 1p1c package evicted after submission can be bumped by a new child before a new block"
  },
  {
   "sha": "7a30d53ca9b4e7704f3473a630e1835ed24268f8",
   "date": "2026-09-24T15:57:48Z",
   "message": "validation: make every package transaction evicted by the final trim reconsiderable\n\nPackage transactions can also be in the mempool before the final trim\nby having been accepted by themselves earlier in the same call, or by\nbeing there already, possibly with a different witness. Make them\nTX_RECONSIDERABLE too when evicted: they are evicted for their feerate\nlike the others and may still be accepted in a package."
  },
  {
   "sha": "3c6cd0c00ab3d81ec6c9615ed812a8976083749c",
   "date": "2026-09-24T16:35:21Z",
   "message": "test: every package transaction evicted by the final trim is reconsiderable"
  }
 ],
 "timeline": [
  {
   "t": "2026-09-24T16:38:19Z",
   "kind": "force_push",
   "who": "instagibbs",
   "commit": "3c6cd0c00ab3d81ec6c9615ed812a8976083749c",
   "id": "push:3c6cd0c00ab3d81ec6c9615ed812a8976083749c"
  },
  {
   "t": "2026-09-28T16:12:19Z",
   "kind": "comment",
   "who": "instagibbs",
   "assoc": "MEMBER",
   "text": "This PR closes out R10: https://gist.github.com/instagibbs/880a76535fd802fced9f9a5253cdbb40",
   "id": "c:5873964246",
   "url": "https://github.com/bitcoin/bitcoin/pull/36328#issuecomment-5873964246",
   "hash": "d1c4e367189178fe",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-09-24T16:39:53Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-24T17:40:58Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-28T17:12:32Z",
   "action": "labeled",
   "label": "P2P",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-09-28T17:12:27Z",
   "kind": "renamed",
   "who": "instagibbs",
   "from": "Reconsider package transactions that are immediately trimmed",
   "to": "p2p: Reconsider package transactions that are immediately trimmed"
  },
  {
   "t": "2026-09-29T10:21:25Z",
   "kind": "milestoned",
   "who": "fanquake"
  }
 ],
 "text_chars": 2346,
 "text_tokens_estimate": 586,
 "changed_paths": [
  "src/test/txpackage_tests.cpp",
  "src/validation.cpp",
  "test/functional/p2p_opportunistic_1p1c.py"
 ],
 "files": [
  {
   "path": "src/test/txpackage_tests.cpp",
   "add": 110,
   "del": 0
  },
  {
   "path": "src/validation.cpp",
   "add": 23,
   "del": 6
  },
  {
   "path": "test/functional/p2p_opportunistic_1p1c.py",
   "add": 61,
   "del": 1
  }
 ],
 "test_lines": 172,
 "git": {
  "head": "3c6cd0c00ab3d81ec6c9615ed812a8976083749c",
  "head_matches_backup": true,
  "base": "bfdcd9797cd1a1345bdaf7ee7ef48f94028262da",
  "patch_id": "2e47c294da30bf5e",
  "commits": [
   {
    "sha": "47c9070b9d",
    "subject": "validation: make package transactions trimmed after submission reconsiderable",
    "files": 1,
    "add": 5,
    "del": 2
   },
   {
    "sha": "7235f02718",
    "subject": "test: 1p1c package evicted after submission can be bumped by a new child before a new block",
    "files": 1,
    "add": 61,
    "del": 1
   },
   {
    "sha": "7a30d53ca9",
    "subject": "validation: make every package transaction evicted by the final trim reconsiderable",
    "files": 1,
    "add": 18,
    "del": 4
   },
   {
    "sha": "3c6cd0c00a",
    "subject": "test: every package transaction evicted by the final trim is reconsiderable",
    "files": 1,
    "add": 110,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "2e47c294da30bf5e",
 "input_hash": "feb57f8da8a70b7c",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}