{
 "number": 36567,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36567",
 "title": "psbt: drop Taproot and MuSig2 signatures when adding an input",
 "author": "Ravan002",
 "author_association": "FIRST_TIME_CONTRIBUTOR",
 "created_at": "2026-10-18T19:50:26Z",
 "updated_at": "2026-10-19T12:22:17Z",
 "description_hash": "7a306c3cbfaa6a4e",
 "age_days": 14,
 "draft": false,
 "labels": [
  "PSBT"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "b40ac85ff5df1f3a32912a990bddfffed3a64cb7",
 "head_ref": "psbt-addinput-taproot-sigs",
 "head_repo": "Ravan002/bitcoin",
 "head_history": [],
 "additions": 18,
 "deletions": 0,
 "changed_files": 2,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "unstable",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "jpk68",
      "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6256748323"
     },
     {
      "login": "Yudis-bit",
      "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6265386045"
     }
    ],
    "concept_ack": [
     {
      "login": "fametrano",
      "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6256309295"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "fametrano": {
   "kind": "concept_ack",
   "hash": "b40ac85",
   "t": "2026-10-18T23:07:25Z",
   "stale": false
  },
  "jpk68": {
   "kind": "ack",
   "hash": "b40ac85ff5df1f3a32912a990bddfffed3a64cb7",
   "t": "2026-10-18T23:55:50Z",
   "stale": false
  },
  "Yudis-bit": {
   "kind": "ack",
   "hash": "b40ac85ff5",
   "t": "2026-10-19T10:44:15Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 2,
  "stale_ack": 0,
  "concept_ack": 1,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "Yudis-bit",
   "fametrano",
   "jpk68"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "unstable",
  "last_author_activity": "2026-10-18T19:50:04Z",
  "last_reviewer_activity": "2026-10-19T10:44:15Z",
  "last_reviewer": "Yudis-bit",
  "author_silent_days": 14,
  "waiting_on_author_days": 13,
  "days_since_update": 13
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "`PartiallySignedTransaction::AddInput` clears `partial_sigs`, `final_script_sig` and `final_script_witness` of the input it adds, because the transaction is about to change and those signatures would no longer be valid. The Taproot key and script signatures and the MuSig2 pubnonces and partial signatures were left in place, so `joinpsbts` handed back inputs carrying signatures for the old transaction.\n\nThey are cleared in the same place now.\n\nThe functional test joins two PSBTs with signed Taproot inputs: before the change the joined inputs still have `taproot_key_path_sig`, after it they don't, and the wallet can sign the joined PSBT. It fails on master at that assertion. `rpc_psbt.py` and the psbt unit tests pass.",
 "commits": [
  {
   "sha": "b40ac85ff5df1f3a32912a990bddfffed3a64cb7",
   "date": "2026-10-18T19:50:04Z",
   "message": "psbt: drop Taproot and MuSig2 signatures when adding an input\n\nPartiallySignedTransaction::AddInput clears partial_sigs, final_script_sig\nand final_script_witness because adding an input changes the transaction,\nbut kept the Taproot key and script signatures and the MuSig2 nonces and\npartial signatures. joinpsbts therefore returned inputs that carried\nsignatures for a different transaction."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-18T23:07:25Z",
   "kind": "comment",
   "who": "fametrano",
   "assoc": "CONTRIBUTOR",
   "text": "Concept ACK b40ac85. With this PR, the v0 branch of `AddInput` clears every field that `PSBTInput::HasSignatures` checks, plus the MuSig2 public nonces. [btclib-wallet](https://github.com/btclib-org/btclib-wallet/blob/22ee823a4dd5377b37d7b5f3dc1fc54408b28f83/src/btclib_wallet/psbt/psbt.py#L3896-L3912), which I maintain, clears the same seven fields when it joins v0 PSBTs. I ran this PR's test scenario through it: no joined input keeps a key-path signature, and the joined PSBT signs both inputs again.",
   "id": "c:6256309295",
   "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6256309295",
   "hash": "6b835b82e280cdd6",
   "edited": null
  },
  {
   "t": "2026-10-18T23:55:50Z",
   "kind": "comment",
   "who": "jpk68",
   "assoc": "CONTRIBUTOR",
   "text": "ACK b40ac85ff5df1f3a32912a990bddfffed3a64cb7",
   "id": "c:6256748323",
   "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6256748323",
   "hash": "f3a2134c3b85590e",
   "edited": null
  },
  {
   "t": "2026-10-19T10:44:15Z",
   "kind": "comment",
   "who": "Yudis-bit",
   "assoc": "NONE",
   "text": "Tested ACK b40ac85ff5 on Windows.",
   "id": "c:6265386045",
   "url": "https://github.com/bitcoin/bitcoin/pull/36567#issuecomment-6265386045",
   "hash": "7c6d47c318d0774f",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-19T03:28:02Z",
   "action": "labeled",
   "label": "PSBT",
   "who": "fanquake"
  },
  {
   "t": "2026-10-19T07:14:33Z",
   "action": "unlabeled",
   "label": "PSBT",
   "who": "maflcko"
  },
  {
   "t": "2026-10-19T07:14:37Z",
   "action": "labeled",
   "label": "PSBT",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 1765,
 "text_tokens_estimate": 441,
 "changed_paths": [
  "src/psbt.cpp",
  "test/functional/rpc_psbt.py"
 ],
 "files": [
  {
   "path": "src/psbt.cpp",
   "add": 4,
   "del": 0
  },
  {
   "path": "test/functional/rpc_psbt.py",
   "add": 14,
   "del": 0
  }
 ],
 "test_lines": 14,
 "git": {
  "head": "b40ac85ff5df1f3a32912a990bddfffed3a64cb7",
  "head_matches_backup": true,
  "base": "924f4c4ac78b0cd3b917c694f42c0651a6f3003a",
  "patch_id": "783df144640522a7",
  "commits": [
   {
    "sha": "b40ac85ff5",
    "subject": "psbt: drop Taproot and MuSig2 signatures when adding an input",
    "files": 2,
    "add": 18,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "783df144640522a7",
 "input_hash": "727c45095e0ec6e8",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}