{
 "number": 31252,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/31252",
 "title": "rpc: print P2WSH and P2SH redem Script in getrawtransaction and getblock",
 "author": "polespinasa",
 "author_association": "MEMBER",
 "created_at": "2024-11-07T20:39:24Z",
 "updated_at": "2026-09-15T23:54:03Z",
 "age_days": 678,
 "draft": false,
 "labels": [
  "RPC/REST/ZMQ"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
 "head_ref": "p2wsh_redeem",
 "head_repo": "polespinasa/bitcoin",
 "head_history": [
  {
   "t": "2024-11-13T11:43:40Z",
   "sha": "4e128d4f9b219a73fe5c09869bf64641d6c61f0e"
  },
  {
   "t": "2024-11-22T18:23:20Z",
   "sha": "404d0dd812f4a217b299862ec02b2e4540d10375"
  },
  {
   "t": "2024-11-22T18:27:15Z",
   "sha": "8b23ec79a8c3150a6b4d5a2c744c7fbfc219b7be"
  },
  {
   "t": "2024-11-22T20:53:40Z",
   "sha": "43dbc696b9e9bb5472b01708d33e022042b5ce3b"
  },
  {
   "t": "2025-05-08T16:20:40Z",
   "sha": "5ed169960246384dffe5eb5cc9c9762f041f2806"
  },
  {
   "t": "2025-05-08T16:31:06Z",
   "sha": "101f610d58d90a55cbfb67dbb363f94fe3993972"
  },
  {
   "t": "2025-05-08T16:42:11Z",
   "sha": "503fab3cd5d145549a58922d85efb195a90007e6"
  },
  {
   "t": "2025-05-08T16:59:25Z",
   "sha": "f89a8d41f749f9d7ba5a53f6fb7a49b5b3bbbd38"
  },
  {
   "t": "2025-05-08T17:03:11Z",
   "sha": "b57b46d25f44951a18ddff5774bad54de9c10113"
  },
  {
   "t": "2025-05-08T17:11:03Z",
   "sha": "3791c4d02252f93ad459cd682aeaa46796fe0541"
  },
  {
   "t": "2025-05-08T17:24:44Z",
   "sha": "58ac220e857da32401a7291f77b4b8a864e80ebb"
  },
  {
   "t": "2025-09-15T18:22:03Z",
   "sha": "1d156fce6f1634ca796e4e1ecf1763494f7d4fb2"
  },
  {
   "t": "2025-09-15T18:35:21Z",
   "sha": "18c513f8babf65ea73ea9c785fba90446ef947db"
  },
  {
   "t": "2025-09-16T20:26:26Z",
   "sha": "2318af98f8514b0a3d31a2954649dabb067e4fd1"
  },
  {
   "t": "2026-01-13T08:20:31Z",
   "sha": "7341f0ec0b53618172ed05df820fa296cd0217b7"
  },
  {
   "t": "2026-01-20T10:20:31Z",
   "sha": "2aa405a80e8f98c5a7838639f84bb53b8af4deff"
  },
  {
   "t": "2026-06-19T16:02:02Z",
   "sha": "1d0aa8051f89f69b1ee93ed4cce724bdd7121a11"
  },
  {
   "t": "2026-06-19T16:35:27Z",
   "sha": "ef91d23a1956f6eb0e035c11060a5e8fee477744"
  },
  {
   "t": "2026-06-19T17:59:00Z",
   "sha": "30dd396d876ad04cf1df8231095b51bd05659985"
  },
  {
   "t": "2026-06-19T19:56:07Z",
   "sha": "5bfd57d081f44d591b4c7e957f18faf08226a948"
  },
  {
   "t": "2026-06-19T21:16:59Z",
   "sha": "811e9e22c55673eaefa41b69702c47dd6de0ab5f"
  },
  {
   "t": "2026-06-19T21:29:38Z",
   "sha": "879de87097533f1cd122d4f5910838afcfee44ba"
  },
  {
   "t": "2026-06-19T21:30:40Z",
   "sha": "befcd3bf02fda611101908c633383de4c112865b"
  },
  {
   "t": "2026-06-20T06:18:45Z",
   "sha": "fa0267b7fb74d4681b2ad2383cd84d963c6eee5f"
  },
  {
   "t": "2026-07-27T07:03:02Z",
   "sha": "df11883bfcf145aca0388174575d6cf4339ee94d"
  },
  {
   "t": "2026-07-27T07:16:23Z",
   "sha": "a4136842389441e999f77647957e98707bf8b8ba"
  },
  {
   "t": "2026-09-10T08:40:02Z",
   "sha": "a1b8ada6928b7587514398a46f296a3385046997"
  },
  {
   "t": "2026-09-10T08:40:46Z",
   "sha": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9"
  }
 ],
 "additions": 369,
 "deletions": 5,
 "changed_files": 10,
 "commit_count": 5,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "concept_ack": [
     {
      "login": "murchandamus",
      "url": "https://github.com/bitcoin/bitcoin/pull/31252#issuecomment-3480436431"
     },
     {
      "login": "sedited",
      "url": "https://github.com/bitcoin/bitcoin/pull/31252#pullrequestreview-4532476320"
     }
    ]
   },
   "conflicts": [
    {
     "number": 36250,
     "title": "rpc: clarify sendrawtransaction decode error",
     "author": "MrHodlX"
    },
    {
     "number": 35569,
     "title": "Encapsulation for CTransaction",
     "author": "purpleKarrot"
    }
   ]
  }
 },
 "acks_parsed": {
  "murchandamus": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2025-11-03T13:07:36Z",
   "stale": false
  },
  "sedited": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-06-19T12:34:46Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 2,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "kevkevinpal",
   "luke-jr",
   "murchandamus",
   "naiyoma",
   "sedited"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-09-10T08:41:40Z",
  "last_reviewer_activity": "2026-09-09T15:04:41Z",
  "last_reviewer": "sedited",
  "author_silent_days": 7,
  "waiting_on_author_days": 0,
  "days_since_update": 1
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": [
   36250,
   35569
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/core_io.cpp",
  "src/core_write.cpp",
  "src/script/script.cpp",
  "src/script/script.h",
  "src/script/solver.cpp",
  "test/functional/rpc_rawtransaction.py"
 ],
 "body": "This PR is motivated by https://github.com/bitcoin/bitcoin/issues/27391.\nAnd inspired by a previous PR https://github.com/bitcoin/bitcoin/pull/8849 that proposed something similar.\n\nThis is an example with a real mainnet transaction (3-5 multisig) and using ``getrawtransaction 'txid' 2`` and `getblock`. It also affects the endpoint `rest/getblock`\n\nVerbosity must be set to 2 or higher if possible.\n\n```json\n$ bitcoin-cli getrawtransaction 44f5ab666cb9dccef69120fe5b51757a647c1f96882931a9faa0b2b5781ddfd2 2 000000000000000000018fa64b5e32335f7d3ac14b9e5553db20f2909c902c34\n{\n  \"in_active_chain\": true,\n  \"txid\": \"44f5ab666cb9dccef69120fe5b51757a647c1f96882931a9faa0b2b5781ddfd2\",\n  \"hash\": \"53836d2a4fb1e14356eac69fe1dad8be5dfd9a1b8101bc8aeb04ea2a320aa398\",\n  \"version\": 1,\n  \"size\": 382,\n  \"vsize\": 192,\n  \"weight\": 766,\n  \"locktime\": 0,\n  \"vin\": [\n    {\n      \"txid\": \"d15236206fbe06d6f38505656a2006a9a5a1ddf189a2647750091fd218d59581\",\n      \"vout\": 2,\n      \"scriptSig\": {\n        \"asm\": \"\",\n        \"hex\": \"\"\n      },\n      \"txinwitness\": [\n        \"\",\n        \"304402204d91eb67d798d071278ea0570973f3488d60c3ec98a611856f6a813b2e35df3202200bb36403ebd2dcc96b236efaf07db4f1da26b1031fc854548634ff44a340dc6601\",\n        \"3044022046abaa75082c2d1cdef57f8ef59a0046729220eabe2c2a229d1d592b89ccf1b0022028954703f13d836b1b77acd1eb72639a7a918d756fdd3ddef1d42a28567403ed01\",\n        \"522102f69779f4bb466a8c0aa7d6bf2a2dde34e44bae29d5186ee0c3bed4d903d57fa7210333c337637453164d5fd0dc31787a614a74d2acca5c08710937b9b831bd41b11f2103be7c86e40ad380b33f9abd653c6d04b95b818abd5653b63402678fcc45a017e753ae\"\n      ],\n      \"witnessScript\": {\n        \"asm\": \"2 02f69779f4bb466a8c0aa7d6bf2a2dde34e44bae29d5186ee0c3bed4d903d57fa7 0333c337637453164d5fd0dc31787a614a74d2acca5c08710937b9b831bd41b11f 03be7c86e40ad380b33f9abd653c6d04b95b818abd5653b63402678fcc45a017e7 3 OP_CHECKMULTISIG\",\n        \"desc\": \"multi(2,02f69779f4bb466a8c0aa7d6bf2a2dde34e44bae29d5186ee0c3bed4d903d57fa7,0333c337637453164d5fd0dc31787a614a74d2acca5c08710937b9b831bd41b11f,03be7c86e40ad380b33f9abd653c6d04b95b818abd5653b63402678fcc45a017e7)#sll5t8hh\",\n        \"type\": \"multisig\"\n      },\n      \"prevout\": {\n        ... bla bla bla prev output info ...\n        }\n      },\n      \"sequence\": 4294967293\n    }\n  ],\n  \"vout\": [ ... bla bla bla outputs ...  ],\n  \"fee\": 0.00000594,\n  \"hex\": \"010000000001018195d518d21f09507764a289f1dda1a5a906206a650585f3d606be6f203652d10200000000fdffffff025b730500000000001976a914381d46badae879d1c6037a03da52074e3914812c88ac38088000000000002200205ab691555ede8432ed7765585edb1c9b285532daf639e3e5ccd4843ff3b04cdf040047304402204d91eb67d798d071278ea0570973f3488d60c3ec98a611856f6a813b2e35df3202200bb36403ebd2dcc96b236efaf07db4f1da26b1031fc854548634ff44a340dc6601473044022046abaa75082c2d1cdef57f8ef59a0046729220eabe2c2a229d1d592b89ccf1b0022028954703f13d836b1b77acd1eb72639a7a918d756fdd3ddef1d42a28567403ed0169522102f69779f4bb466a8c0aa7d6bf2a2dde34e44bae29d5186ee0c3bed4d903d57fa7210333c337637453164d5fd0dc31787a614a74d2acca5c08710937b9b831bd41b11f2103be7c86e40ad380b33f9abd653c6d04b95b818abd5653b63402678fcc45a017e753ae00000000\",\n  \"blockhash\": \"000000000000000000018fa64b5e32335f7d3ac14b9e5553db20f2909c902c34\",\n  \"confirmations\": 1,\n  \"time\": 1746727602,\n  \"blocktime\": 1746727602\n}\n\n```",
 "commits": [
  {
   "sha": "f9fbaa96a6e7f238fdf092c65e8fc0972baec299",
   "date": "2026-07-11T15:08:43Z",
   "message": "refactor: make use of already created variables for better readability"
  },
  {
   "sha": "cddc8e2fd2f8833757ae57ebf27d187261a730c7",
   "date": "2026-09-10T08:23:46Z",
   "message": "rpc: Decode P2(W)SH scripts if data from prev tx is available and verbose is 2\n\nAdds include_scripts (default false) to TxDocOptions to allow specifying if redeemScript and\nwitnessScript fields must be added to the RPC documentation.\n\nAdds GetRedeemAndWitnessScripts() which takes a CScript object and a CTransaction input and\nreturns the reedem script and witness script depending if it is a P2WSH, P2SH or P2SH-P2W(PK-S)H.\nAdds a struct RedeemAndWitnessScripts for returning the scripts.\n\nUpdates TxToUniv to include redeemScript and witnessScript if the verbose and the undo data allows it,\nfields include asm, desc, type and adress."
  },
  {
   "sha": "cb2af16f4da2421a01f4c8712b2607f620eecf1e",
   "date": "2026-09-10T08:24:08Z",
   "message": "test: test that getrawtransaction with verbosity 2 returns the redeem and witness script"
  },
  {
   "sha": "af7d78048e581cfa27e3bd70b3fb30d366fb0b83",
   "date": "2026-09-10T08:24:12Z",
   "message": "test: test getblock with verbosity returns redeemscript and witness script if possible"
  },
  {
   "sha": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "date": "2026-09-10T08:40:38Z",
   "message": "doc: add release notes for redeemScript/witnessScript RPC fields"
  }
 ],
 "timeline": [
  {
   "t": "2024-11-13T03:10:53Z",
   "kind": "review_comment",
   "who": "kevkevinpal",
   "assoc": "CONTRIBUTOR",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": null,
   "text": "I think it might make more sense to name it \"witnessScript\" instead of \"witScript\", It might be confusing to some if it is abbreviated\n```suggestion\n                in.pushKV(\"witnessScript\", std::move(witScript));\n```"
  },
  {
   "t": "2024-11-13T03:12:19Z",
   "kind": "comment",
   "who": "kevkevinpal",
   "assoc": "CONTRIBUTOR",
   "text": "can we squash 66ea8941de3dfd498319c6390655a165f6a5a92b and 84fb299de72ca9e08fe5029380a779d57d302347\nto a single commit"
  },
  {
   "t": "2024-11-13T11:36:02Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 1839327299,
   "text": "I agree, it needs to be changed in one more place apart from this line but yes I will apply it.\nThanks!"
  },
  {
   "t": "2024-11-13T11:43:40Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "4e128d4f9b219a73fe5c09869bf64641d6c61f0e"
  },
  {
   "t": "2024-11-20T23:51:50Z",
   "kind": "review_comment",
   "who": "luke-jr",
   "assoc": "CONTRIBUTOR",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": null,
   "text": "This isn't an indicator of p2wsh... Maybe use d1f0ff0e1fed2c4124d0d81f18daf7b76a770dda or similar?"
  },
  {
   "t": "2024-11-22T18:23:20Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "404d0dd812f4a217b299862ec02b2e4540d10375"
  },
  {
   "t": "2024-11-22T18:27:15Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "8b23ec79a8c3150a6b4d5a2c744c7fbfc219b7be"
  },
  {
   "t": "2024-11-22T18:29:44Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 1851133029,
   "text": "code rewritten based on this comment"
  },
  {
   "t": "2024-11-22T20:53:40Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "43dbc696b9e9bb5472b01708d33e022042b5ce3b"
  },
  {
   "t": "2025-01-11T12:36:28Z",
   "kind": "review",
   "who": "naiyoma",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "43dbc696b9e9bb5472b01708d33e022042b5ce3b",
   "text": "I've tested https://github.com/bitcoin/bitcoin/pull/31252/commits/43dbc696b9e9bb5472b01708d33e022042b5ce3b on regtest, and both (P2SH redeemScript and P2WSH witnessScript )are only being decompiled when calling getblock \u2026 2. I think you should consider editing the PR description to indicate exactly what is working so far."
  },
  {
   "t": "2025-01-27T09:42:25Z",
   "kind": "comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nThanks for the review and testing! Yes, the description was outdated to the first implementation of it. Updated \ud83e\udee1"
  },
  {
   "t": "2025-02-11T20:50:52Z",
   "kind": "review_comment",
   "who": "naiyoma",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": null,
   "text": "the value of `have_undo` is always going to be 0 when calling` getrawtransaction` hence the reason why this only works for `getblock..2`"
  },
  {
   "t": "2025-02-12T08:12:14Z",
   "kind": "review_comment",
   "who": "naiyoma",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": null,
   "text": "this outputs `redeemScript` for both P2SH and P2WSH, but it should be\nP2SH `redeemScript` and P2WSH `witnessScript`"
  },
  {
   "t": "2025-02-12T08:59:15Z",
   "kind": "review_comment",
   "who": "naiyoma",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 1951583490,
   "text": "This is not a suggestion to replace your current approach, but rather an alternative way. I have an implementation here ->[https://github.com/naiyoma/bitcoin/pull/1/commits/ff82e551404e55c75b1950e01e4f4626f5ad452e](https://github.com/naiyoma/bitcoin/pull/1/commits/ff82e551404e55c75b1950e01e4f4626f5ad452e)  that shows how to decompile  outside of `if(have_undo) `. While it needs more testing, it successfully works for both `getrawtransaction `and `getblock..2`. You might find some ideas there for handling` getrawtransaction `."
  },
  {
   "t": "2025-05-08T16:20:40Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "5ed169960246384dffe5eb5cc9c9762f041f2806"
  },
  {
   "t": "2025-05-08T16:21:16Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 1952168882,
   "text": "done"
  },
  {
   "t": "2025-05-08T16:24:39Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/core_write.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 1951583490,
   "text": "Sorry for the delay, got this PR a bit abandoned, re-taking it now :).\n\nThanks for the suggestion!\nThe problem is that I don't see the way to detect the type without the previous transaction.\nYour patch is similar to my first approach. If you test with a P2SH-P2WPKH, the decoding is done wrong."
  },
  {
   "t": "2025-05-08T16:31:06Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "101f610d58d90a55cbfb67dbb363f94fe3993972"
  },
  {
   "t": "2025-05-08T16:42:11Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "503fab3cd5d145549a58922d85efb195a90007e6"
  },
  {
   "t": "2025-05-08T16:59:25Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "f89a8d41f749f9d7ba5a53f6fb7a49b5b3bbbd38"
  },
  {
   "t": "2025-05-08T17:03:11Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "b57b46d25f44951a18ddff5774bad54de9c10113"
  },
  {
   "t": "2025-05-08T17:11:03Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "3791c4d02252f93ad459cd682aeaa46796fe0541"
  },
  {
   "t": "2025-05-08T17:24:44Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "58ac220e857da32401a7291f77b4b8a864e80ebb"
  },
  {
   "t": "2025-05-08T17:29:05Z",
   "kind": "comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "text": "Rebased on top of master 58ac220e857da32401a7291f77b4b8a864e80ebb\n\n@Sjors maybe you would like to review this"
  },
  {
   "t": "2025-08-26T20:37:46Z",
   "kind": "review_comment",
   "who": "naiyoma",
   "assoc": "MEMBER",
   "path": "src/script/script.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": null,
   "text": "For a non-P2SH transaction, returning` -1` will result in a `redeemScript` field being added.\nI tested this using a P2PKH transaction, and this was the output: `\"redeemScript\": { \"asm\": \"304402...7981\", \"type\": \"nonstandard\" }\"`"
  },
  {
   "t": "2025-09-15T18:22:03Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "1d156fce6f1634ca796e4e1ecf1763494f7d4fb2"
  },
  {
   "t": "2025-09-15T18:22:51Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/script.cpp",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1",
   "in_reply_to": 2302086009,
   "text": "Nice catch!\nYou're right, solved in 18c513f8babf65ea73ea9c785fba90446ef947db.\nNow non-P2SH and non-segwit inputs return -2 and don't show any script as it's out the scope of the PR."
  },
  {
   "t": "2025-09-15T18:35:21Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "18c513f8babf65ea73ea9c785fba90446ef947db"
  },
  {
   "t": "2025-09-16T20:26:26Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "2318af98f8514b0a3d31a2954649dabb067e4fd1"
  },
  {
   "t": "2025-11-03T13:07:36Z",
   "kind": "comment",
   "who": "murchandamus",
   "assoc": "MEMBER",
   "text": "Concept ACK"
  },
  {
   "t": "2026-01-13T08:20:31Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "7341f0ec0b53618172ed05df820fa296cd0217b7"
  },
  {
   "t": "2026-01-13T08:33:26Z",
   "kind": "comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "text": "Rebased to resolve conflicts with https://github.com/bitcoin/bitcoin/pull/32517, only moved `DecodeTxDoc` from `rawtransaction.cpp` to `rawtransaction_util.cpp`"
  },
  {
   "t": "2026-01-20T10:20:31Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "2aa405a80e8f98c5a7838639f84bb53b8af4deff"
  },
  {
   "t": "2026-06-19T11:33:03Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/script/script.h",
   "commit": "1d0aa8051f89f69b1ee93ed4cce724bdd7121a11",
   "in_reply_to": null,
   "text": "We usually put forward declarations at the top of the headers."
  },
  {
   "t": "2026-06-19T11:40:41Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/core_io.cpp",
   "commit": "fa0267b7fb74d4681b2ad2383cd84d963c6eee5f",
   "in_reply_to": null,
   "text": "`TxToUniv` is used by a few other callers besides the rawtransaction rpcs. Are they effected by this change too?"
  },
  {
   "t": "2026-06-19T12:00:09Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/script/script.cpp",
   "commit": "fd5c964c0560613266171cb7112b756a7f277882",
   "in_reply_to": null,
   "text": "I think it would be good to avoid including the interpreter here. Looking at the existing contents of this file, I also don't think this extractor really fits in here. Could we teak script/sign.cpp's `DataFromTransaction` to return the required `SignatureData` from the transactions instead?"
  },
  {
   "t": "2026-06-19T12:34:46Z",
   "kind": "review",
   "who": "sedited",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "2aa405a80e8f98c5a7838639f84bb53b8af4deff",
   "text": "Concept ACK\n\nIs returning the descriptor of the redeem script useful for anything? There have been a few changes in some of the rpc code, can you do a rebase for them? This also still needs a release note."
  },
  {
   "t": "2026-06-19T15:58:51Z",
   "kind": "comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nI am not sure, I added it as \"free\" extra information in case it is useful for something I am not aware of.\n\nAdded the field following sjors idea from the original issue :)\n[quoted text omitted]\n\nJokes a side, I am happy dropping it if we don't want it."
  },
  {
   "t": "2026-06-19T16:02:02Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "1d0aa8051f89f69b1ee93ed4cce724bdd7121a11"
  },
  {
   "t": "2026-06-19T16:02:33Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/script.h",
   "commit": "1d0aa8051f89f69b1ee93ed4cce724bdd7121a11",
   "in_reply_to": 3442181193,
   "text": "done"
  },
  {
   "t": "2026-06-19T16:14:56Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/script.cpp",
   "commit": "fd5c964c0560613266171cb7112b756a7f277882",
   "in_reply_to": 3442320419,
   "text": "[quoted text omitted]\n\nDidn't check how to do it but, should we?\n\n```\n// Extracts signatures and scripts from incomplete scriptSigs. Please do not extend this, use PSBT instead\nSignatureData DataFromTransaction(const CMutableTransaction& tx, unsigned int nIn, const CTxOut& txout)\n{\n```"
  },
  {
   "t": "2026-06-19T16:33:25Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/core_io.cpp",
   "commit": "fa0267b7fb74d4681b2ad2383cd84d963c6eee5f",
   "in_reply_to": 3442229811,
   "text": "~Yes, all of them if I am not wrong.~ Will update the PR description.\n\nUpdate: Only `getblock` is affected and the `/rest/block` endpoint.\n\n`decodepsbt` calls TxToUniv() with the default `txundo=nullptr`.\n`gettransaction` explicitly passes `txundo=nullptr`.\n\nSo they are not affected as without `txundo` the data is not available."
  },
  {
   "t": "2026-06-19T16:35:27Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "ef91d23a1956f6eb0e035c11060a5e8fee477744"
  },
  {
   "t": "2026-06-19T17:59:00Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "30dd396d876ad04cf1df8231095b51bd05659985"
  },
  {
   "t": "2026-06-19T19:54:34Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/script.cpp",
   "commit": "fd5c964c0560613266171cb7112b756a7f277882",
   "in_reply_to": 3442320419,
   "text": "I moved the function from script.cpp to solver.cpp I am not sure if it is where it should be, but moved it to avoid a recursive inclusion."
  },
  {
   "t": "2026-06-19T19:56:07Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "5bfd57d081f44d591b4c7e957f18faf08226a948"
  },
  {
   "t": "2026-06-19T21:16:59Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "811e9e22c55673eaefa41b69702c47dd6de0ab5f"
  },
  {
   "t": "2026-06-19T21:29:38Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "879de87097533f1cd122d4f5910838afcfee44ba"
  },
  {
   "t": "2026-06-19T21:30:40Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "befcd3bf02fda611101908c633383de4c112865b"
  },
  {
   "t": "2026-06-20T06:18:45Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "fa0267b7fb74d4681b2ad2383cd84d963c6eee5f"
  },
  {
   "t": "2026-07-10T16:22:38Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/core_io.cpp",
   "commit": "f88e1fc39cb3bcf1f8cef8920bf3b9ed54e68b3c",
   "in_reply_to": null,
   "text": "In the release notes you say that the redeem script is populated for both case, but I think it is either or, no? I think I'd prefer including both, but then I'd also return a struct with optional fields or something instead of status codes that need to be interpreted here."
  },
  {
   "t": "2026-07-10T16:42:55Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "test/functional/rpc_rawtransaction.py",
   "commit": "f9b7019527890ba00077b69b698e4d2b0961cf6d",
   "in_reply_to": null,
   "text": "Don't you want the following here?\n```diff\ndiff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py\nindex d36cdbd397..6307b786ea 100755\n--- a/test/functional/rpc_rawtransaction.py\n+++ b/test/functional/rpc_rawtransaction.py\n@@ -312 +312 @@ class RawTransactionsTest(BitcoinTestFramework):\n-        assert_equal(['asm', 'desc', 'type'].sort(), list(res_p2sh_tx['vin'][0]['redeemScript'].keys()).sort())\n+        assert_equal(sorted(['asm', 'desc', 'type']), sorted(res_p2sh_tx['vin'][0]['redeemScript'].keys()))\n@@ -320 +320 @@ class RawTransactionsTest(BitcoinTestFramework):\n-        assert_equal(['asm', 'desc', 'type'].sort(), list(res_p2wsh_tx['vin'][0]['witnessScript'].keys()).sort())\n+        assert_equal(sorted(['asm', 'desc', 'type']), sorted(res_p2wsh_tx['vin'][0]['witnessScript'].keys()))\n```"
  },
  {
   "t": "2026-07-10T16:53:33Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/core_io.cpp",
   "commit": "fa0267b7fb74d4681b2ad2383cd84d963c6eee5f",
   "in_reply_to": null,
   "text": "Can you add argument doc hints to all the arguments here? If this includes the address shouldn't that be in the docs too and get a functional test exercising the field?"
  },
  {
   "t": "2026-07-11T10:36:09Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "test/functional/rpc_rawtransaction.py",
   "commit": "f9b7019527890ba00077b69b698e4d2b0961cf6d",
   "in_reply_to": 3560528699,
   "text": "taken"
  },
  {
   "t": "2026-07-27T07:03:02Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "df11883bfcf145aca0388174575d6cf4339ee94d"
  },
  {
   "t": "2026-07-27T07:16:23Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "a4136842389441e999f77647957e98707bf8b8ba"
  },
  {
   "t": "2026-07-27T07:23:51Z",
   "kind": "comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "text": "I refactored a bit the PR and added some better testing.\nI think now the code is clearer and it is easier to review :)\n\nAlso took some changes suggested by sedited."
  },
  {
   "t": "2026-09-08T15:29:42Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/script/solver.cpp",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "in_reply_to": null,
   "text": "Should we also add a branch for the nested segwit case? It seems more natural to me to not clear its redeem script."
  },
  {
   "t": "2026-09-09T14:22:28Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/solver.cpp",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "in_reply_to": 3959554221,
   "text": "The redeem script will only be a hash of the witness program, which I don't think is useful at all.\nIn which cases you think it would be useful information?"
  },
  {
   "t": "2026-09-09T15:04:41Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "src/script/solver.cpp",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "in_reply_to": 3959554221,
   "text": "You say in the comments of the functional test yourself that is just the witness program, not the hash of it. That seems fine to include in my eyes, no? Maybe there is somebody who would like to \"unwrap\" their address or something (not suggesting that this should be a supported operation). It's also commonly shown on block explorers."
  },
  {
   "t": "2026-09-10T08:18:02Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/solver.cpp",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "in_reply_to": 3959554221,
   "text": "Oh you are right, sorry. Too long since I look at this PR.\nActually the change is pretty straight forward as can just remove the `redeem_script.clear()` line at the end, as p2tr and p2wpkh never set the redeem script. It was only cleared for P2SH-P2WPKH.\nThe case for P2SH-P2WSH was already ok inside the if block you added this comment."
  },
  {
   "t": "2026-09-10T08:40:02Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "a1b8ada6928b7587514398a46f296a3385046997"
  },
  {
   "t": "2026-09-10T08:40:46Z",
   "kind": "force_push",
   "who": "polespinasa",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9"
  },
  {
   "t": "2026-09-10T08:41:40Z",
   "kind": "review_comment",
   "who": "polespinasa",
   "assoc": "MEMBER",
   "path": "src/script/solver.cpp",
   "commit": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
   "in_reply_to": 3959554221,
   "text": "Done :)"
  }
 ],
 "labels_log": [
  {
   "t": "2024-11-07T20:39:29Z",
   "action": "labeled",
   "label": "RPC/REST/ZMQ",
   "who": "DrahtBot"
  },
  {
   "t": "2024-11-07T21:50:55Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-11-08T16:45:11Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-03-21T16:53:01Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-08T20:20:17Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-17T02:54:14Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-18T05:58:58Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-11-11T12:00:28Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-01-13T08:59:34Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-01-19T17:51:35Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-01-20T11:34:18Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-19T16:35:54Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-20T01:26:23Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-20T07:29:11Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-20T07:47:10Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-27T07:16:58Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-27T08:21:47Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-10T08:41:50Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-09-10T09:47:36Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2024-11-07T20:39:43Z",
   "kind": "renamed",
   "who": "polespinasa",
   "from": "rpc: print P2WSH redeemScript in getrawtransaction",
   "to": "rpc: print P2WSH witScript in getrawtransaction"
  },
  {
   "t": "2024-11-07T20:52:38Z",
   "kind": "convert_to_draft",
   "who": "polespinasa"
  },
  {
   "t": "2024-11-08T19:18:52Z",
   "kind": "ready_for_review",
   "who": "polespinasa"
  },
  {
   "t": "2025-01-27T09:40:04Z",
   "kind": "renamed",
   "who": "polespinasa",
   "from": "rpc: print P2WSH witScript in getrawtransaction",
   "to": "rpc: print P2WSH and P2SH redem Script in getrawtransaction"
  },
  {
   "t": "2025-04-11T11:52:20Z",
   "kind": "convert_to_draft",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-08T16:21:04Z",
   "kind": "ready_for_review",
   "who": "polespinasa"
  },
  {
   "t": "2026-01-13T08:55:20Z",
   "kind": "renamed",
   "who": "polespinasa",
   "from": "rpc: print P2WSH and P2SH redem Script in getrawtransaction",
   "to": "rpc: print P2WSH and P2SH redem Script in (get/decode)rawtransaction"
  },
  {
   "t": "2026-06-19T16:53:26Z",
   "kind": "renamed",
   "who": "polespinasa",
   "from": "rpc: print P2WSH and P2SH redem Script in (get/decode)rawtransaction",
   "to": "rpc: print P2WSH and P2SH redem Script in (get/decode)rawtransaction and getblock"
  },
  {
   "t": "2026-06-19T17:46:21Z",
   "kind": "renamed",
   "who": "polespinasa",
   "from": "rpc: print P2WSH and P2SH redem Script in (get/decode)rawtransaction and getblock",
   "to": "rpc: print P2WSH and P2SH redem Script in getrawtransaction and getblock"
  }
 ],
 "text_chars": 11249,
 "text_tokens_estimate": 2812,
 "changed_paths": [
  "doc/release-notes-31252.md",
  "src/core_io.cpp",
  "src/rpc/blockchain.cpp",
  "src/rpc/rawtransaction.cpp",
  "src/rpc/rawtransaction_util.cpp",
  "src/rpc/rawtransaction_util.h",
  "src/script/solver.cpp",
  "src/script/solver.h",
  "test/functional/rpc_blockchain.py",
  "test/functional/rpc_rawtransaction.py"
 ],
 "files": [
  {
   "path": "doc/release-notes-31252.md",
   "add": 9,
   "del": 0
  },
  {
   "path": "src/core_io.cpp",
   "add": 17,
   "del": 3
  },
  {
   "path": "src/rpc/blockchain.cpp",
   "add": 2,
   "del": 0
  },
  {
   "path": "src/rpc/rawtransaction.cpp",
   "add": 1,
   "del": 0
  },
  {
   "path": "src/rpc/rawtransaction_util.cpp",
   "add": 20,
   "del": 0
  },
  {
   "path": "src/rpc/rawtransaction_util.h",
   "add": 2,
   "del": 0
  },
  {
   "path": "src/script/solver.cpp",
   "add": 38,
   "del": 0
  },
  {
   "path": "src/script/solver.h",
   "add": 25,
   "del": 0
  },
  {
   "path": "test/functional/rpc_blockchain.py",
   "add": 72,
   "del": 1
  },
  {
   "path": "test/functional/rpc_rawtransaction.py",
   "add": 183,
   "del": 1
  }
 ],
 "test_lines": 257,
 "git": {
  "head": "9d23cae2f7620711e8292dcda8ae2a9c3a7f94f9",
  "head_matches_backup": true,
  "base": "1a2523e901a6c7c876c8a0817601e77d83f394b9",
  "commits": [
   {
    "sha": "f9fbaa96a6",
    "subject": "refactor: make use of already created variables for better readability",
    "files": 1,
    "add": 3,
    "del": 3
   },
   {
    "sha": "cddc8e2fd2",
    "subject": "rpc: Decode P2(W)SH scripts if data from prev tx is available and verbose is 2",
    "files": 7,
    "add": 102,
    "del": 0
   },
   {
    "sha": "cb2af16f4d",
    "subject": "test: test that getrawtransaction with verbosity 2 returns the redeem and witness script",
    "files": 1,
    "add": 183,
    "del": 1
   },
   {
    "sha": "af7d78048e",
    "subject": "test: test getblock with verbosity returns redeemscript and witness script if possible",
    "files": 1,
    "add": 72,
    "del": 1
   },
   {
    "sha": "9d23cae2f7",
    "subject": "doc: add release notes for redeemScript/witnessScript RPC fields",
    "files": 1,
    "add": 9,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "982af0e9b344fc7d",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}