{
 "number": 36393,
 "input_hash": "84134898cbad910a",
 "model": "ledger",
 "prompt_hash": null,
 "created": "2026-10-21T01:17:30+00:00",
 "result": {
  "summary": "Enforces caller-specified `max_tx_weight` during wallet transaction creation when preset inputs already cover the payment amount. Previously, bypassing coin selection left only the default `MAX_STANDARD_TX_WEIGHT` ceiling in the final guard of `CreateTransactionInternal`.",
  "problem": "When preset inputs fully fund a transaction, coin selection is bypassed along with its weight constraints. The final transaction weight check compared against the 400,000 WU standard network limit rather than the caller's requested `max_tx_weight`, allowing RPC methods like `fundrawtransaction` to output transactions heavier than requested.",
  "card": "Wallet transaction funding (`fundrawtransaction`) fails to enforce custom `max_tx_weight` limits when preset inputs alone satisfy the target amount. Because coin selection exits early, the wallet's final weight check previously verified against the standard 400,000 WU network limit instead of the user-provided maximum. This change checks against the configured maximum weight in the final guard and adds regression tests.",
  "evidence": [
   "Author reproduced the issue using 10 legacy inputs and `max_tx_weight=4000`: funding succeeded with a 6,168 WU transaction instead of returning an error, under both `add_inputs=false` and `add_inputs=true` (PR description)."
  ],
  "scope_notes": "",
  "changed_since_previous": "Unchanged in approach; likely updated comments or rebased since the previous revision.",
  "thread": {
   "last_event_at": "2026-10-19T14:42:27Z",
   "events": 8,
   "head_sha": "37f3c7da4e9f00f24bce2aca57f454207fe08875",
   "schema_floor": 2,
   "schema": 2
  },
  "waiting_on": [
   {
    "at": "2026-10-19",
    "id": "c:6269938953",
    "on": "reviewer",
    "url": "https://github.com/bitcoin/bitcoin/pull/36393#issuecomment-6269938953",
    "what": "re-review after author addressed comment nits"
   }
  ],
  "risk": {
   "level": "medium",
   "touches": [
    "wallet"
   ],
   "why": "A bug in wallet transaction weight checking could inadvertently reject valid funding attempts or throw an unhandled exception during transaction construction."
  },
  "discussion": {
   "author_status": "last statement processed 2026-10-19",
   "open_concerns": [],
   "resolved_concerns": [
    "jcastros: whether the final check should enforce the 1000 vbyte TRUC limit for preset inputs or leave it for a follow-up (answered by gjija 2026-10-04)"
   ]
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "Nothing known that would invalidate a review now."
  },
  "agreement": {
   "state": "Strong",
   "summary": "Strong: substantive support, no open objection (jcastros, vicjuma)",
   "reason": "The author pushed a comment-only update addressing vicjuma's code comment nits.",
   "evidence": [
    "jcastros: ACK \u2014 tested reproduction of max_tx_weight behavior with legacy inputs and verified wallet_fundrawtransaction.py fails without the fix and passes with it",
    "vicjuma: Concept ACK \u2014 tested with ~830 weighted transactions (2 P2WPKH inputs + 1 P2WPKH output) and confirmed it works as expected"
   ],
   "objections": [
    {
     "reviewer": "jcastros",
     "association": "CONTRIBUTOR",
     "type": "question",
     "kind": "scope",
     "harm": "",
     "request": "",
     "question": "whether the final check should enforce the 1000 vbyte TRUC limit for preset inputs or leave it for a follow-up",
     "text": "whether the final check should enforce the 1000 vbyte TRUC limit for preset inputs or leave it for a follow-up",
     "clears_with": "answer",
     "blocking": false,
     "status": "answered",
     "status_note": "author replied that TRUC child-limit fix should be handled in a follow-up",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [
      "c:5983627867"
     ],
     "evidence": "2026-10-03: 'Should this final check enforce that cap as well, or do you want it as a follow-up?'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36393#issuecomment-5972098738",
     "id": "c:5972098738",
     "at": "2026-10-03",
     "status_at": "2026-10-04",
     "status_by": "gjija",
     "resolution_evidence": "2026-10-04: gjija: 'I\u2019d keep the TRUC child-limit fix as a follow-up, since it reproduces on the parent too.'",
     "pin": null,
     "from_schema": 2
    }
   ],
   "support": [
    {
     "reviewer": "jcastros",
     "reason": "tested reproduction of max_tx_weight behavior with legacy inputs and verified wallet_fundrawtransaction.py fails without the fix and passes with it",
     "substantive": true,
     "verdict": "ACK",
     "id": "c:5972098738",
     "url": "https://github.com/bitcoin/bitcoin/pull/36393#issuecomment-5972098738",
     "at": "2026-10-03",
     "association": "CONTRIBUTOR",
     "evidence": "both",
     "areas": []
    },
    {
     "reviewer": "vicjuma",
     "reason": "tested with ~830 weighted transactions (2 P2WPKH inputs + 1 P2WPKH output) and confirmed it works as expected",
     "substantive": true,
     "verdict": "Concept ACK",
     "id": "r:5553688144",
     "url": "https://github.com/bitcoin/bitcoin/pull/36393#pullrequestreview-5553688144",
     "at": "2026-10-16",
     "association": "CONTRIBUTOR",
     "evidence": "both",
     "areas": [
      "src/wallet/spend.cpp",
      "test/functional/wallet_fundrawtransaction.py"
     ]
    }
   ],
   "participants": [
    {
     "login": "jcastros",
     "stance": "support",
     "note": "tested and ACKed; asked about TRUC child-limit scope which author answered",
     "association": "CONTRIBUTOR",
     "comments": 1,
     "first": "2026-10-03",
     "last": "2026-10-03"
    },
    {
     "login": "vicjuma",
     "stance": "support",
     "note": "Concept ACK with testing; left minor nits on comments",
     "association": "CONTRIBUTOR",
     "comments": 3,
     "first": "2026-10-16",
     "last": "2026-10-16"
    }
   ],
   "derivation": "substantive support, no open objection (jcastros, vicjuma)",
   "model_state": null,
   "corrections": [],
   "notes": "The author pushed a comment-only update addressing vicjuma's code comment nits."
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "wallet",
    "member": true,
    "evidence": "Landed in src/wallet/spend.cpp and labeled Wallet, modifying transaction creation weight validation.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.35,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 0,
     "user_value": 1
    },
    "rationale": "Fixes a bug where caller-specified `max_tx_weight` is ignored during wallet transaction creation when preset inputs fully cover the transaction amount. In `CreateTransactionInternal`, bypassing coin selection fell back to checking against `MAX_STANDARD_TX_WEIGHT` (400,000 WU) instead of the caller's parameter, allowing RPCs like `fundrawtransaction` to output transactions exceeding requested weight limits."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": []
 },
 "cost_usd": 0.0,
 "source": {
  "record": "2026-10-21T01:17:30+00:00",
  "code": "2026-10-21T01:23:34+00:00",
  "judgments": 1
 }
}