{
 "number": 35370,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35370",
 "title": "rpc: add key-origin modes to PSBT processing RPCs",
 "author": "junbyjun1238",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-05-25T13:29:43Z",
 "updated_at": "2026-09-10T16:58:24Z",
 "age_days": 115,
 "draft": false,
 "labels": [
  "RPC/REST/ZMQ"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "af752153f75c74ce44b54d335d0e135c4385df9f",
 "head_ref": "rpc-strip-psbt-bip32-derivs",
 "head_repo": "junbyjun1238/bitcoin",
 "head_history": [
  {
   "t": "2026-07-10T09:56:56Z",
   "sha": "af752153f75c74ce44b54d335d0e135c4385df9f"
  }
 ],
 "additions": 331,
 "deletions": 10,
 "changed_files": 9,
 "commit_count": 2,
 "size_bucket": "M",
 "mergeable_state": "unknown",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "concept_ack": [
     {
      "login": "rkrux",
      "url": "https://github.com/bitcoin/bitcoin/pull/35370#issuecomment-4752694434"
     }
    ],
    "approach_ack": [
     {
      "login": "willcl-ark",
      "url": "https://github.com/bitcoin/bitcoin/pull/35370#pullrequestreview-4380078190"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "willcl-ark": {
   "kind": "approach_ack",
   "hash": null,
   "t": "2026-05-28T10:18:00Z",
   "stale": false
  },
  "rkrux": {
   "kind": "concept_ack",
   "hash": "2ec9650",
   "t": "2026-06-19T15:06:18Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 1,
  "approach_ack": 1,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "achow101",
   "maflcko",
   "rkrux",
   "willcl-ark"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "unknown",
  "last_author_activity": "2026-07-10T09:56:56Z",
  "last_reviewer_activity": "2026-07-10T09:38:10Z",
  "last_reviewer": "maflcko",
  "author_silent_days": 69,
  "waiting_on_author_days": 0,
  "days_since_update": 6
 },
 "refs": {
  "mentioned": [
   30294,
   30341
  ],
  "depends_on": [],
  "fixes": [
   30294
  ],
  "linked_issues": [
   {
    "number": 30294,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "Setting `bip32derivs` to `false` with `walletprocesspsbt` includes `bip32_derivs` for outputs."
   }
  ],
  "references": [
   {
    "number": 30294,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "Setting `bip32derivs` to `false` with `walletprocesspsbt` includes `bip32_derivs` for outputs."
   },
   {
    "number": 30341,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Permit Combiner to strip bip32_deriv information"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/rpc/rawtransaction_util.h",
  "test/functional/rpc_psbt.py"
 ],
 "body": "This PR extends the existing `bip32derivs` argument of the\n`walletprocesspsbt` and `descriptorprocesspsbt` RPCs with explicit key-origin\nmodes.\n\n## Motivation\n\nSetting `bip32derivs=false` prevents new key-origin fields from being added, but\ndoes not explicitly remove fields already present in an input PSBT. Some\ncollaborative PSBT workflows need to remove that metadata before sharing the\nPSBT.\n\n## Behavior\n\n- `true` or `\"add\"` allows known key-origin fields to be added.\n- `false` or `\"preserve\"` does not add or explicitly remove key-origin fields.\n- `\"strip\"` does not add key-origin fields and removes surviving standard\n  key-origin fields after normal processing.\n\nThe default remains `true`. The existing boolean values remain accepted for\ncompatibility.\n\nStripping removes global xpubs and legacy and Taproot BIP32 derivation fields\nfrom inputs and outputs. Unknown and proprietary PSBT fields are left\nunchanged. Finalization may independently remove input key-origin fields.\n\nCloses #30294.",
 "commits": [
  {
   "sha": "ba0860fc7995de6698d49cb2168857419766ef2a",
   "date": "2026-07-10T09:46:27Z",
   "message": "psbt: add helper to strip key-origin fields\n\nRemove global xpubs and input and output BIP32 derivation fields\nwhile leaving other PSBT data unchanged."
  },
  {
   "sha": "af752153f75c74ce44b54d335d0e135c4385df9f",
   "date": "2026-07-10T09:46:27Z",
   "message": "rpc: add key-origin modes to PSBT RPCs\n\nAllow bip32derivs to select add, preserve, or strip behavior in\nwalletprocesspsbt and descriptorprocesspsbt. Keep true and false as\naliases for add and preserve."
  }
 ],
 "timeline": [
  {
   "t": "2026-05-28T10:18:00Z",
   "kind": "review",
   "who": "willcl-ark",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "2ec965091ceda40ba8b6c0eefc07aed8b6e7324b",
   "text": "Approach ACK.\n\nThis looks like the correct approach (in contrast to #30341), putting strip functionality  in `walletprocesspsbt` (and also `descriptorprocesspsbt`)."
  },
  {
   "t": "2026-05-28T23:27:45Z",
   "kind": "comment",
   "who": "achow101",
   "assoc": "MEMBER",
   "text": "The option does more than stripping bip32 derivation paths and it's name should reflect that.\n\nI'm not sure about stacking yet another bool argument. Maybe it would be better to convert the existing `bip32derivs` into a enum/choices argument."
  },
  {
   "t": "2026-06-19T15:06:18Z",
   "kind": "comment",
   "who": "rkrux",
   "assoc": "MEMBER",
   "text": "Concept ACK 2ec9650 for stripping away the bip32 derivations data if the user intends so.\n\n[quoted text omitted]\nI'm inclining to agree with this. I think it'd be good to avoid having a new similar looking argument that sort of overlaps with the existing one (based on what's described in the \"Behaviour\" section). I also believe that updating the existing bip32derivs to accept an enum would be worth the breaking change. Fortunately, the name of the bip32derivs argument already is generic enough that it's functionality can be extended."
  },
  {
   "t": "2026-07-10T06:22:56Z",
   "kind": "comment",
   "who": "junbyjun1238",
   "assoc": "CONTRIBUTOR",
   "text": "Reworked in e5adbdfbe9. The separate `stripbip32derivs` boolean has been removed, and the existing `bip32derivs` argument now accepts `\"add\"`, `\"preserve\"`, and `\"strip\"` for both processing RPCs. Existing `true` and `false` values remain aliases for `\"add\"` and `\"preserve\"` so current callers keep their behavior.\n\nThe helper and RPC documentation now describe the full key-origin scope: global xpubs and legacy and Taproot BIP32 derivation fields. Normal processing and finalization behavior remain unchanged."
  },
  {
   "t": "2026-07-10T08:03:07Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/rpc/rawtransaction_util.h",
   "commit": "3ec87212ebd5bb373658d35720e673a797f360ba",
   "in_reply_to": null,
   "text": "nit: would be good to avoid ALL_CAPS going forward for new code. The dev notes aren't updated yet (c.f. https://github.com/bitcoin/bitcoin/pull/35588#discussion_r3470054402), but lately there was a scripted-diff roughly every two weeks to rename an ALL_CAPS to PascalCase or snake_case, due to a third-party macro clash."
  },
  {
   "t": "2026-07-10T08:04:45Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "test/functional/rpc_psbt.py",
   "commit": "3ec87212ebd5bb373658d35720e673a797f360ba",
   "in_reply_to": null,
   "text": "The test supports --usecli, so why is this duplicate?"
  },
  {
   "t": "2026-07-10T08:06:38Z",
   "kind": "review",
   "who": "maflcko",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "3ec87212ebd5bb373658d35720e673a797f360ba",
   "text": "Given that this is LLM generated, please make sure to adhere to the https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md"
  },
  {
   "t": "2026-07-10T09:18:03Z",
   "kind": "comment",
   "who": "junbyjun1238",
   "assoc": "CONTRIBUTOR",
   "text": "I authored the original PR and the initial revisions myself. For these additional changes, I used an LLM as a tool. Unfortunately, I failed to properly catch the issues before pushing. I have now personally reviewed both the original and current changes, and I fully understand the content. I have also reviewed the AI policy, and going forward, I will take personal responsibility for reviewing changes and responding to feedback."
  },
  {
   "t": "2026-07-10T09:37:10Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYou can remove this whole LLM generated redundant section. A human can see that you modified `test/functional/rpc_psbt.py` and can see that this is a test meant for the change."
  },
  {
   "t": "2026-07-10T09:38:10Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits and https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#committing-patches"
  },
  {
   "t": "2026-07-10T09:56:56Z",
   "kind": "force_push",
   "who": "junbyjun1238",
   "commit": "af752153f75c74ce44b54d335d0e135c4385df9f"
  }
 ],
 "labels_log": [
  {
   "t": "2026-05-25T13:29:47Z",
   "action": "labeled",
   "label": "RPC/REST/ZMQ",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-25T13:33:12Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-25T14:17:12Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-10T07:23:51Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-10T08:53:10Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-10T09:57:23Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-10T10:59:33Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-07-10T06:22:42Z",
   "kind": "renamed",
   "who": "junbyjun1238",
   "from": "rpc: add stripbip32derivs to PSBT processing RPCs",
   "to": "rpc: add key-origin modes to PSBT processing RPCs"
  }
 ],
 "text_chars": 4213,
 "text_tokens_estimate": 1053,
 "changed_paths": [
  "doc/release-notes-35370.md",
  "src/psbt.cpp",
  "src/psbt.h",
  "src/rpc/client.cpp",
  "src/rpc/rawtransaction.cpp",
  "src/rpc/rawtransaction_util.cpp",
  "src/rpc/rawtransaction_util.h",
  "src/wallet/rpc/spend.cpp",
  "test/functional/rpc_psbt.py"
 ],
 "files": [
  {
   "path": "doc/release-notes-35370.md",
   "add": 11,
   "del": 0
  },
  {
   "path": "src/psbt.cpp",
   "add": 15,
   "del": 0
  },
  {
   "path": "src/psbt.h",
   "add": 3,
   "del": 0
  },
  {
   "path": "src/rpc/client.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/rpc/rawtransaction.cpp",
   "add": 13,
   "del": 3
  },
  {
   "path": "src/rpc/rawtransaction_util.cpp",
   "add": 21,
   "del": 0
  },
  {
   "path": "src/rpc/rawtransaction_util.h",
   "add": 8,
   "del": 0
  },
  {
   "path": "src/wallet/rpc/spend.cpp",
   "add": 13,
   "del": 2
  },
  {
   "path": "test/functional/rpc_psbt.py",
   "add": 245,
   "del": 3
  }
 ],
 "test_lines": 248,
 "git": {
  "head": "af752153f75c74ce44b54d335d0e135c4385df9f",
  "head_matches_backup": true,
  "base": "de925455c8025fc1f75d65d981c28b9dfa20e9f7",
  "commits": [
   {
    "sha": "ba0860fc79",
    "subject": "psbt: add helper to strip key-origin fields",
    "files": 2,
    "add": 18,
    "del": 0
   },
   {
    "sha": "af752153f7",
    "subject": "rpc: add key-origin modes to PSBT RPCs",
    "files": 7,
    "add": 313,
    "del": 10
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "3ec8c3b8b15b0ce4",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}