{
 "number": 36343,
 "input_hash": "63cd2c4cf81f123e",
 "model": "ledger",
 "prompt_hash": null,
 "created": "2026-10-31T01:17:08+00:00",
 "result": {
  "summary": "Check PSBTInputSignedAndVerified for each input in FinalizePSBT before marking it complete. This prevents FinalizePSBT from unconditionally trusting pre-existing final scriptSig or scriptWitness fields without verifying them against standard execution flags.",
  "problem": "When a PSBT input has a non-witness UTXO and already contains final script fields, SignPSBTInput accepts them and ProduceSignature returns early before script verification. As a result, finalizepsbt can report complete: true and return a raw transaction hex whose script fails mempool verification, contradicting analyzepsbt which reports the input as not final.",
  "card": "FinalizePSBT now verifies final scriptSig and scriptWitness data using PSBTInputSignedAndVerified before marking an input complete. Previously, inputs with a non_witness_utxo and existing final fields were trusted without script checks, causing finalizepsbt to return complete: true along with raw transaction hex that fails mempool verification. This aligns FinalizePSBT with fixes previously made to FillPSBT (#30357) and descriptorprocesspsbt (#33014). An intentional side effect is that inputs with consensus-valid but non-standard final scripts will now return complete: false.",
  "evidence": [
   "PR description demonstrates reproduction: flipping a bit in the final witness of a P2WPKH PSBT causes finalizepsbt to output complete: true with a hex that testmempoolaccept rejects with 'mempool-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)', while analyzepsbt marks the input not final",
   "Author cites prior merged fixes applying the same check to other PSBT entry points: #30357 for FillPSBT and #33014 for descriptorprocesspsbt"
  ],
  "scope_notes": "Small logic change in FinalizePSBT with an added functional test and release note.",
  "changed_since_previous": "Added release notes document doc/release-notes-36343.md.",
  "thread": {
   "last_event_at": "2026-10-30T11:41:08Z",
   "events": 5,
   "head_sha": "7148c65121cbe7225acc9ab789146c3632f9de97",
   "schema_floor": 2,
   "schema": 2
  },
  "waiting_on": [
   {
    "at": "2026-10-30",
    "id": "c:6521767967",
    "on": "author",
    "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-6521767967",
    "what": "response to Bicaru20's suggestion on analyzepsbt next role"
   }
  ],
  "risk": {
   "level": "medium",
   "touches": [
    "rpc_api"
   ],
   "why": "A flaw in final script verification could mistakenly reject valid PSBTs or block transaction finalization in RPC workflows."
  },
  "discussion": {
   "author_status": "last statement processed 2026-10-30",
   "open_concerns": [
    "Bicaru20: Update AnalyzePSBT or SignPSBTInput so that analyzepsbt returns next: updater instead of finalizer when final scriptSig or scriptWitness fields fail verification"
   ],
   "resolved_concerns": [
    "fametrano: Add a release note describing the behavior change where consensus-valid but non-standard scripts now return complete=false. (accepted by fametrano 2026-10-03)"
   ]
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "Nothing known that would invalidate a review now."
  },
  "agreement": {
   "state": "Strong",
   "summary": "Strong: substantive support, no open objection (fametrano, fametrano)",
   "reason": "Added Bicaru20's Concept ACK and suggestion regarding updating analyzepsbt to report updater when verification of final scripts fails.",
   "evidence": [
    "Bicaru20 (suggestion, interface, must be answered, open): Update AnalyzePSBT or SignPSBTInput so that analyzepsbt returns next: updater instead of finalizer when final scriptSig or scriptWitness fields fail verification",
    "fametrano: Tested ACK \u2014 verified the bugfix on pkh, sh-wpkh, wpkh, and taproot inputs; verified non-standard inputs match walletprocesspsbt behavior",
    "fametrano: ACK \u2014 Only the release note is new since my Tested ACK, and it matches the code.",
    "l0rinc: Concept ACK",
    "Bicaru20: Concept ACK"
   ],
   "objections": [
    {
     "reviewer": "fametrano",
     "association": "NONE",
     "type": "suggestion",
     "kind": "maintenance",
     "harm": "",
     "request": "Add a release note describing the behavior change where consensus-valid but non-standard scripts now return complete=false.",
     "question": "",
     "text": "Add a release note describing the behavior change where consensus-valid but non-standard scripts now return complete=false.",
     "clears_with": "answer",
     "blocking": false,
     "status": "accepted",
     "status_note": "reviewer confirmed the added release note matches the code",
     "cleared": true,
     "author_replied": true,
     "others_replied": false,
     "fix_pushed": true,
     "replies": [
      "c:5955738380"
     ],
     "evidence": "2026-10-02: 'it may deserve a release note'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-5951768922",
     "id": "c:5951768922",
     "at": "2026-10-02",
     "status_at": "2026-10-03",
     "status_by": "fametrano",
     "resolution_evidence": "2026-10-03: fametrano: 'Only the release note is new since my Tested ACK, and it matches the code.'",
     "pin": null,
     "from_schema": 2
    },
    {
     "reviewer": "Bicaru20",
     "association": "CONTRIBUTOR",
     "type": "suggestion",
     "kind": "interface",
     "harm": "",
     "request": "Update AnalyzePSBT or SignPSBTInput so that analyzepsbt returns next: updater instead of finalizer when final scriptSig or scriptWitness fields fail verification",
     "question": "",
     "text": "Update AnalyzePSBT or SignPSBTInput so that analyzepsbt returns next: updater instead of finalizer when final scriptSig or scriptWitness fields fail verification",
     "clears_with": "answer",
     "blocking": false,
     "status": "open",
     "status_note": "",
     "cleared": false,
     "author_replied": false,
     "others_replied": false,
     "fix_pushed": false,
     "replies": [],
     "evidence": "2026-10-30: 'Since the final script_sig or final script_witness failed verification and in the same test we see that when trying to finalize the psbt it fails, I belvie this field on `analyzepsbt` can be missleading and should return `updater`.'",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-6521767967",
     "id": "c:6521767967",
     "at": "2026-10-30",
     "status_at": null,
     "status_by": null,
     "resolution_evidence": "",
     "pin": null,
     "from_schema": 2
    }
   ],
   "support": [
    {
     "reviewer": "fametrano",
     "reason": "verified the bugfix on pkh, sh-wpkh, wpkh, and taproot inputs; verified non-standard inputs match walletprocesspsbt behavior",
     "substantive": true,
     "verdict": "Tested ACK",
     "id": "c:5951768922",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-5951768922",
     "at": "2026-10-02",
     "association": "NONE",
     "evidence": "both",
     "areas": []
    },
    {
     "reviewer": "fametrano",
     "reason": "Only the release note is new since my Tested ACK, and it matches the code.",
     "substantive": true,
     "verdict": "ACK",
     "id": "c:5968528317",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-5968528317",
     "at": "2026-10-03",
     "association": "NONE",
     "evidence": "read",
     "areas": [
      "doc/release-notes.md"
     ]
    },
    {
     "reviewer": "l0rinc",
     "reason": "",
     "substantive": false,
     "verdict": "Concept ACK",
     "id": "c:6468028476",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-6468028476",
     "at": "2026-10-28",
     "association": "MEMBER",
     "evidence": "none",
     "areas": []
    },
    {
     "reviewer": "Bicaru20",
     "reason": "",
     "substantive": false,
     "verdict": "Concept ACK",
     "id": "c:6521767967",
     "url": "https://github.com/bitcoin/bitcoin/pull/36343#issuecomment-6521767967",
     "at": "2026-10-30",
     "association": "CONTRIBUTOR",
     "evidence": "read",
     "areas": [
      "src/node/psbt.cpp",
      "test/functional/rpc_psbt.py"
     ]
    }
   ],
   "participants": [
    {
     "login": "fametrano",
     "stance": "support",
     "note": "Tested ACK across multiple input types; reACKed after confirming release note was added",
     "association": "NONE",
     "comments": 2,
     "first": "2026-10-02",
     "last": "2026-10-03"
    },
    {
     "login": "l0rinc",
     "stance": "support",
     "note": "Concept ACK",
     "association": "MEMBER",
     "comments": 1,
     "first": "2026-10-28",
     "last": "2026-10-28"
    },
    {
     "login": "Bicaru20",
     "stance": "support",
     "note": "Concept ACK; suggested updating analyzepsbt or SignPSBTInput so next returns updater instead of finalizer when final fields fail verification",
     "association": "CONTRIBUTOR",
     "comments": 1,
     "first": "2026-10-30",
     "last": "2026-10-30"
    }
   ],
   "derivation": "substantive support, no open objection (fametrano, fametrano)",
   "model_state": null,
   "corrections": [],
   "notes": "Added Bicaru20's Concept ACK and suggestion regarding updating analyzepsbt to report updater when verification of final scripts fails."
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "docs",
    "member": false,
    "evidence": "The documentation change is solely an accompanying release note for the PSBT bug fix.",
    "band": "Unranked",
    "reason_tag": "bug fix",
    "score": 0.0,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "A code change that updates its release notes is excluded from the documentation category."
   },
   {
    "name": "rpc",
    "member": true,
    "evidence": "Modifies FinalizePSBT behavior exposed by the finalizepsbt RPC without wallet code, which the wallet category explicitly routes to rpc.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.4,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Prevents finalizepsbt from falsely returning 'complete: true' and emitting an invalid raw transaction hex when pre-existing final scripts fail verification. As the reproduction notes, an invalid witness could previously cause finalizepsbt to claim completion while testmempoolaccept rejected the transaction with a script verification failure."
   },
   {
    "name": "wallet",
    "member": false,
    "evidence": "Touches only src/psbt.cpp and RPC tests without altering wallet-specific code or data structures.",
    "band": "Unranked",
    "reason_tag": "bug fix",
    "score": 0.0,
    "factors": {
     "bug_severity": 1,
     "leverage": 0,
     "performance": 0,
     "security_stability": 1,
     "user_value": 1
    },
    "rationale": "Under the category definition, PSBT changes that affect RPC without modifying wallet code belong to rpc rather than wallet."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": []
 },
 "cost_usd": 0.0,
 "source": {
  "record": "2026-10-31T01:17:08+00:00",
  "code": "2026-10-04T01:20:29+00:00",
  "judgments": 3
 }
}