{
 "number": 34520,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/34520",
 "title": "refactor: Add [[nodiscard]] to functions returning bool+mutable ref",
 "author": "maflcko",
 "author_association": "MEMBER",
 "created_at": "2026-02-05T16:58:07Z",
 "updated_at": "2026-10-29T20:30:32Z",
 "description_hash": "0ab7b21e503efc9b",
 "age_days": 269,
 "draft": true,
 "labels": [
  "Refactoring",
  "CI failed"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "1bd568e2c70840f606eab1157b35b1f06dab1e29",
 "head_ref": "2602-nodiscard",
 "head_repo": "maflcko/bitcoin-core",
 "head_history": [
  {
   "t": "2026-02-05T18:21:06Z",
   "sha": "fac5685e867b4a9ec334ed1ee31aabacd1c3124e"
  },
  {
   "t": "2026-02-26T13:31:43Z",
   "sha": "fadf57856058c875f69c20ac3041fa402349ee50"
  },
  {
   "t": "2026-02-26T13:33:46Z",
   "sha": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4"
  },
  {
   "t": "2026-03-13T14:41:25Z",
   "sha": "597b75f128185ce55bd5b814d6b483f5b2a53265"
  },
  {
   "t": "2026-03-26T19:03:38Z",
   "sha": "31aa627d619cc1619e18926b8d26b4346c3add43"
  },
  {
   "t": "2026-03-31T15:53:03Z",
   "sha": "97a7250b1b01d449cf0abec980b2674d1435893f"
  },
  {
   "t": "2026-04-03T10:14:17Z",
   "sha": "fa97a912e836943b33d21e83807fb8784e7abceb"
  },
  {
   "t": "2026-04-07T18:39:43Z",
   "sha": "fac34ae17baeb661103219cbb7a313db07f8d61b"
  },
  {
   "t": "2026-04-07T18:43:06Z",
   "sha": "fa08ce6493ead77a9644dd72b162d908eb22cd19"
  },
  {
   "t": "2026-05-19T14:19:45Z",
   "sha": "ee8d96fa43eb0f5dc953dd073640ac8fc2033f19"
  },
  {
   "t": "2026-10-23T15:57:51Z",
   "sha": "1bd568e2c70840f606eab1157b35b1f06dab1e29"
  }
 ],
 "additions": 75,
 "deletions": 77,
 "changed_files": 22,
 "commit_count": 3,
 "size_bucket": "M",
 "mergeable_state": "unstable",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "concept_ack": [
     {
      "login": "sedited",
      "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3958551668"
     },
     {
      "login": "ajtowns",
      "url": "https://github.com/bitcoin/bitcoin/pull/34520#pullrequestreview-3894819258"
     }
    ],
    "stale_ack": [
     {
      "login": "HowHsu",
      "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3859820155"
     },
     {
      "login": "yuvicc",
      "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3918951595"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "HowHsu": {
   "kind": "ack",
   "hash": "fac5685",
   "t": "2026-02-06T11:15:08Z",
   "stale": true
  },
  "yuvicc": {
   "kind": "ack",
   "hash": "fac5685e867b4a9ec334ed1ee31aabacd1c3124e",
   "t": "2026-02-18T06:17:51Z",
   "stale": true
  },
  "sedited": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-02-25T11:16:02Z",
   "stale": false
  },
  "ajtowns": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-03-05T08:49:34Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 2,
  "concept_ack": 2,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 1,
  "changes_requested": 0,
  "distinct_reviewers": [
   "HowHsu",
   "ajtowns",
   "ryanofsky",
   "sedited",
   "yuvicc"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": true,
  "mergeable_state": "unstable",
  "last_author_activity": "2026-10-23T15:57:51Z",
  "last_reviewer_activity": "2026-04-08T12:57:33Z",
  "last_reviewer": "ryanofsky",
  "author_silent_days": 9,
  "waiting_on_author_days": 0,
  "days_since_update": 3
 },
 "refs": {
  "mentioned": [
   28690,
   29015
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 28690,
    "type": "pull",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "build: Introduce internal kernel library"
   },
   {
    "number": 29015,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-06-12",
    "title": "kernel: Streamline util library"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/rpc/net.cpp",
  "src/script/descriptor.cpp",
  "src/script/interpreter.cpp"
 ],
 "body": "Legacy code often used a function signature of the form `bool Get...(const& in, mut& in_out);` to implement a getter that optionally returns a value.\n\nIn modern code, this can be replaced by `std::optional<_> Get...(const& in);`.\n\nHowever, some legacy code remains. To ensure that the \"imaginary optional\" is not unwrapped when the getter returns false, add a C++17 `[[nodiscard]]` attribute to all those legacy functions.\n\nThere were only a few places that ignored the return value. I've fixed them in separate commits.\n\nThis should be easy to review via `--word-diff-regex=.` and then confirming that the attribute was added to such a getter.",
 "commits": [
  {
   "sha": "90a82662a95f53f1489bff0d540755a39b1bebc1",
   "date": "2026-10-23T15:56:05Z",
   "message": "refactor: Add [[nodiscard]] to GetOp/GetScriptOp\n\nAlso, assert the return value in CountWitnessSigOps, since it can never\nbe false due to the prior guard on IsPushOnly().\n\nAlso, use the return value in the test. Otherwise, compilation warns:\n\nsrc/test/transaction_tests.cpp:906:9: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]\n  906 |         t.vin[0].scriptSig.GetOp(pc, opcode); // advance to next op\n      |         ^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~\n1 warning generated."
  },
  {
   "sha": "b7c966e57f4268c64d6a8c475f629948200159d7",
   "date": "2026-10-23T15:56:05Z",
   "message": "refactor: Add [[nodiscard]] to GetCachedLastHardenedExtPubKey\n\nAlso, use the return value in one place. This avoids a compile warning:\n\nsrc/script/descriptor.cpp:552:13: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]\n  552 |             cache->GetCachedLastHardenedExtPubKey(m_expr_index, xpub);\n      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~\n1 warning generated."
  },
  {
   "sha": "1bd568e2c70840f606eab1157b35b1f06dab1e29",
   "date": "2026-10-23T15:57:20Z",
   "message": "refactor: Add [[nodiscard]] to functions returning bool+mutable ref"
  }
 ],
 "timeline": [
  {
   "t": "2026-02-05T18:21:06Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fac5685e867b4a9ec334ed1ee31aabacd1c3124e",
   "id": "push:fac5685e867b4a9ec334ed1ee31aabacd1c3124e"
  },
  {
   "t": "2026-02-06T11:15:08Z",
   "kind": "comment",
   "who": "HowHsu",
   "assoc": "CONTRIBUTOR",
   "text": "ACK fac5685",
   "id": "c:3859820155",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3859820155",
   "hash": "b9abb211d657039f",
   "edited": null
  },
  {
   "t": "2026-02-18T06:17:51Z",
   "kind": "comment",
   "who": "yuvicc",
   "assoc": "CONTRIBUTOR",
   "text": "ACK fac5685e867b4a9ec334ed1ee31aabacd1c3124e",
   "id": "c:3918951595",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3918951595",
   "hash": "55bfe0559b2d0560",
   "edited": null
  },
  {
   "t": "2026-02-25T11:16:02Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "Concept ACK\n\nThis looks like a good thing to add, but I wonder if handling these cases incrementally is the correct approach. Outside of these \"getter\" functions there are so many cases where adding [[nodiscard]] make sense too. There is `modernize-use-nodiscard`, but that is too noisy. An alternative might be to roll our own clang tidy plugin that checks for bool return + mutable ref or pointer argument.\n\nDo you also want to add these couple of cases (also added one that takes a mutable pointer):\n\n```diff\ndiff --git a/src/dbwrapper.h b/src/dbwrapper.h\nindex b2ce67c7c2..c2c2a94abd 100644\n--- a/src/dbwrapper.h\n+++ b/src/dbwrapper.h\n@@ -154 +154 @@ public:\n-    template<typename K> bool GetKey(K& key) {\n+    template<typename K> [[nodiscard]] bool GetKey(K& key) {\n@@ -164 +164 @@ public:\n-    template<typename V> bool GetValue(V& value) {\n+    template<typename V> [[nodiscard]] bool GetValue(V& value) {\ndiff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h\nindex 127378ed2f..80a5dc2ac3 100644\n--- a/src/qt/addresstablemodel.h\n+++ b/src/qt/addresstablemodel.h\n@@ -99 +99 @@ private:\n-    bool getAddressData(const QString &address, std::string* name, wallet::AddressPurpose* purpose) const;\n+    [[nodiscard]] bool getAddressData(const QString &address, std::string* name, wallet::AddressPurpose* purpose) const;\ndiff --git a/src/txdb.cpp b/src/txdb.cpp\nindex 27fb76fc4a..a0f55b1cd1 100644\n--- a/src/txdb.cpp\n+++ b/src/txdb.cpp\n@@ -199 +199 @@ std::unique_ptr<CCoinsViewCursor> CCoinsViewDB::Cursor() const\n-        i->pcursor->GetKey(entry);\n+        (void)i->pcursor->GetKey(entry);\n```",
   "id": "c:3958551668",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3958551668",
   "hash": "17b89b82442e6a77",
   "edited": null
  },
  {
   "t": "2026-02-26T13:31:43Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fadf57856058c875f69c20ac3041fa402349ee50",
   "id": "push:fadf57856058c875f69c20ac3041fa402349ee50"
  },
  {
   "t": "2026-02-26T13:33:46Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "id": "push:fa4db474a88fda16ac5ffa551bf8c815c1d61bf4"
  },
  {
   "t": "2026-02-26T13:36:42Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nI wondered that, too. The patch here was written in 2018, but fell off the table. While I rebased it, some places where transformed to std::optional (which should be used in a few more places instead of nodiscard).\n\n[quoted text omitted]\nAre there? I think the attribute should only be used where it really makes sense.\n\n[quoted text omitted]\nI think this will do the exact opposite of what we want: It *ignores* functions that have a mutable ref param. It only adds it to functions that don't really need it in the first place.\n\nHappy to take a look at writing a clang-tidy plugin, maybe as a follow-up?\n\n[quoted text omitted]\nI've also seen this one, but left it for a follow-up, because it is not trivial to see if and why (void) would be the correct fix here. I wanted to keep this pull focussed on mostly mechanical changes for now.\n\n[quoted text omitted]\nThx, done",
   "id": "c:3966687341",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-3966687341",
   "hash": "f35f1d3d29ea9367",
   "edited": null
  },
  {
   "t": "2026-03-05T08:37:25Z",
   "kind": "review_comment",
   "who": "ajtowns",
   "assoc": "MEMBER",
   "path": "src/rpc/net.cpp",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "in_reply_to": null,
   "text": "Shouldn't `proxy.m_tor_stream_isolation` also be conditional on `is_valid` ?",
   "id": "rc:2888516177",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2888516177",
   "hash": "9490d34e0da1b523",
   "edited": "2026-03-05T08:49:34Z"
  },
  {
   "t": "2026-03-05T08:44:48Z",
   "kind": "review_comment",
   "who": "ajtowns",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "in_reply_to": null,
   "text": "I'm uncomfortable with both declaring `[[nodiscard] bool GetOp(...)` and then discarding the return value in consensus code (or non-test code in general).\n\nThe earlier `scriptSig.IsPushOnly()` should guarantee that `GetOp` will never return false, so perhaps `Assume(scriptSig.GetOp(pc, opcode, data))` would be better here?",
   "id": "rc:2888547507",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2888547507",
   "hash": "2c437730b2ba44c7",
   "edited": "2026-03-05T08:49:34Z"
  },
  {
   "t": "2026-03-05T08:48:55Z",
   "kind": "review_comment",
   "who": "ajtowns",
   "assoc": "MEMBER",
   "path": "src/script/descriptor.cpp",
   "commit": "597b75f128185ce55bd5b814d6b483f5b2a53265",
   "in_reply_to": null,
   "text": "Perhaps:\n\n```c++\nif (cache == nullptr || !cache->GetCachedLastHardenedExtPubKey(m_expr_index,xpub) || !xpub.pubkey.IsValid()) {\n    // cache miss, or not cache, or need privkey\n    ...\n}\nassert(xpub.pubkey.IsValid());\n```",
   "id": "rc:2888567547",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2888567547",
   "hash": "48e2c219f8fda154",
   "edited": "2026-03-05T08:49:34Z"
  },
  {
   "t": "2026-03-05T08:49:34Z",
   "kind": "review",
   "who": "ajtowns",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "text": "Concept ACK",
   "id": "r:3894819258",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#pullrequestreview-3894819258",
   "hash": "e8334cc43879b73c",
   "edited": null
  },
  {
   "t": "2026-03-05T12:36:20Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/rpc/net.cpp",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "in_reply_to": 2888516177,
   "text": "Yeah, but I guess `std::optional` could make more sense. Done in https://github.com/bitcoin/bitcoin/pull/34741 and moved this into draft for now.\n\nedit: now merged",
   "id": "rc:2889732879",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2889732879",
   "hash": "80bdd4bb51e3498c",
   "edited": "2026-03-26T19:58:57Z"
  },
  {
   "t": "2026-03-13T14:41:25Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "597b75f128185ce55bd5b814d6b483f5b2a53265",
   "id": "push:597b75f128185ce55bd5b814d6b483f5b2a53265"
  },
  {
   "t": "2026-03-13T14:43:32Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa4db474a88fda16ac5ffa551bf8c815c1d61bf4",
   "in_reply_to": 2888547507,
   "text": "thx, done",
   "id": "rc:2931655499",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2931655499",
   "hash": "76529d57c29d9d97",
   "edited": null
  },
  {
   "t": "2026-03-13T14:43:37Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/script/descriptor.cpp",
   "commit": "597b75f128185ce55bd5b814d6b483f5b2a53265",
   "in_reply_to": 2888567547,
   "text": "Haven't looked here. This is still in draft and I may take a look on the next rebase.\n\nedit: thx, done",
   "id": "rc:2931656052",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2931656052",
   "hash": "1d5c6716eddcbf3b",
   "edited": "2026-03-26T19:58:40Z"
  },
  {
   "t": "2026-03-26T19:03:38Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "31aa627d619cc1619e18926b8d26b4346c3add43",
   "id": "push:31aa627d619cc1619e18926b8d26b4346c3add43"
  },
  {
   "t": "2026-03-31T15:53:03Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "97a7250b1b01d449cf0abec980b2674d1435893f",
   "id": "push:97a7250b1b01d449cf0abec980b2674d1435893f"
  },
  {
   "t": "2026-04-03T10:14:17Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fa97a912e836943b33d21e83807fb8784e7abceb",
   "id": "push:fa97a912e836943b33d21e83807fb8784e7abceb"
  },
  {
   "t": "2026-04-03T14:08:26Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "Rebased, and taken out of draft, now that all feedback is addressed.",
   "id": "c:4183629866",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#issuecomment-4183629866",
   "hash": "160ed11afe67ba90",
   "edited": null
  },
  {
   "t": "2026-04-07T14:40:03Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa9e0570a6e1da609d052e6d2bcdc9744b719c42",
   "in_reply_to": null,
   "text": "In commit \"refactor: Add [[nodiscard]] to GetOp/GetScriptOp\" (fa9e0570a6e1da609d052e6d2bcdc9744b719c42)\n\nI don't think it makes sense to use Assume here. Logically `CountWitnessSigOps` could either be intended to tolerate malformed scripts, in which case it should ignore the GetOp return value, or intended not to tolerate them, in which case it should abort or raise an exception. I don't see how it could realistically be intended to tolerate malformed scripts in release builds but not debug builds.",
   "id": "rc:3045778124",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3045778124",
   "hash": "494e7c1b54130b57",
   "edited": "2026-04-07T14:53:34Z"
  },
  {
   "t": "2026-04-07T14:48:31Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/script/descriptor.cpp",
   "commit": "1bd568e2c70840f606eab1157b35b1f06dab1e29",
   "in_reply_to": null,
   "text": "In commit \"refactor: Add [[nodiscard]] to GetCachedLastHardenedExtPubKey\" (4444e4abc181ccaadeb8788eb4ab90f0a63ab485)\n\nLooks like commit message should be updated. It says \"mark the return value as unused in one place\" which is not what this doing (it is using the return value as an optimization)",
   "id": "rc:3045834413",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3045834413",
   "hash": "dab672d99868e673",
   "edited": "2026-04-07T14:53:34Z"
  },
  {
   "t": "2026-04-07T14:53:34Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "APPROVED",
   "commit": "fa97a912e836943b33d21e83807fb8784e7abceb",
   "text": "Code review fa97a912e836943b33d21e83807fb8784e7abceb. FIrst commit does not seem right to me but otherwise these are nice changes that could prevent bugs.",
   "id": "r:4068977553",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#pullrequestreview-4068977553",
   "hash": "020d22e3a44adfca",
   "edited": "2026-04-07T17:53:05Z"
  },
  {
   "t": "2026-04-07T18:39:43Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fac34ae17baeb661103219cbb7a313db07f8d61b",
   "id": "push:fac34ae17baeb661103219cbb7a313db07f8d61b"
  },
  {
   "t": "2026-04-07T18:43:06Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "fa08ce6493ead77a9644dd72b162d908eb22cd19",
   "id": "push:fa08ce6493ead77a9644dd72b162d908eb22cd19"
  },
  {
   "t": "2026-04-07T19:13:48Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa9e0570a6e1da609d052e6d2bcdc9744b719c42",
   "in_reply_to": 3045778124,
   "text": "This used to be `(void)`, but then I changed it to `Assume` after a review comment (https://github.com/bitcoin/bitcoin/pull/34520#discussion_r2888547507). Now I changed to `Assert`, but I guess tidy uses a release build an now `contrib/devtools/check-deps.sh` fails with:\n\n```\n\nError: interpreter.cpp.o depends on check.cpp.o symbol 'assertion_fail(std::source_location const&, std::basic_string_view<char, std::char_traits<char> >)', can suppress with:\n    SUPPRESS[\"interpreter.cpp.o check.cpp.o _Z14assertion_failRKSt15source_locationSt17basic_string_viewIcSt11char_traitsIcEE\"]=1\nError: Unexpected dependencies were detected. Check previous output.\n```\n\nNot sure how to fix this. I guess I'd have to move `util/check.h` to `crypto`? According to:\n\n```\ndoc/design/libraries.md:98:- *libbitcoin_consensus* should only depend on *libbitcoin_crypto*, and all other libraries besides *libbitcoin_crypto* should be allowed to depend on it.\n```",
   "id": "rc:3047316414",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3047316414",
   "hash": "51041ac24d5a355e",
   "edited": "2026-04-07T19:13:49Z"
  },
  {
   "t": "2026-04-07T19:58:16Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa9e0570a6e1da609d052e6d2bcdc9744b719c42",
   "in_reply_to": 3045778124,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3047316414\n\n[quoted text omitted]\nWould suggest a plain assert:\n\n```c++\nbool got_op = scriptSig.GetOp(pc, opcode, data);;\nassert(got_op); // Guaranteed by IsPushOnly()\n```\n\nOr maybe it is fine for consensus to depend on util though now it is no longer distributed as a separate library. Moving check to crypto could also be ok. Plain assert seems best to me though.",
   "id": "rc:3047543421",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3047543421",
   "hash": "48ce3fdf5aca7d42",
   "edited": "2026-04-07T19:58:17Z"
  },
  {
   "t": "2026-04-07T21:01:49Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa9e0570a6e1da609d052e6d2bcdc9744b719c42",
   "in_reply_to": 3045778124,
   "text": "Ok, I may use `assert` for now, but it seems better to answer the library design question. Otherwise, it will come up again in the future. There is also `kernel_util` from https://github.com/bitcoin/bitcoin/pull/28690, so possibly there is no need consensus to depend on all of `util`, but it may be fine to depend on `kernel_util`.",
   "id": "rc:3047849591",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3047849591",
   "hash": "03210868cc04ced5",
   "edited": null
  },
  {
   "t": "2026-04-08T12:57:33Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/script/interpreter.cpp",
   "commit": "fa9e0570a6e1da609d052e6d2bcdc9744b719c42",
   "in_reply_to": 3045778124,
   "text": "[quoted text omitted]\n\nYes, it looks like the underlying problem is that `util/check.h` depends on some globals like `g_detail_test_only_CheckFailuresAreExceptionsNotAborts` and `g_enable_dynamic_fuzz_determinism` which need to live in some library. Otherwise `check.h` could be a header-only dependency.\n\nI don't think it particularly matters where those globals live. The easiest thing to do which preserves existing dependencies and would not be a bad solution IMO would be to move these globals to the `crypto` library like `hex_base` was moved there in #29015, since everything can depend on `crypto`. Or maybe introduce a small core or globals library to hold these and maybe other things like `G_TRANSLATION_FUN`. The kernel_util idea from #28690 also seems ok (with some different naming since probably wallet and consensus libraries should not depend on a iibrary with \"kernel\" in the name)\n\nAnother option would to just let the `consensus` library depend on `util`. I don't think there would be harm from that if consensus is not distributed separately.\n\nBut I don't think it would be good to make library dependency changes in this PR if `assert` fits well here, which it seems like it does.",
   "id": "rc:3051461827",
   "url": "https://github.com/bitcoin/bitcoin/pull/34520#discussion_r3051461827",
   "hash": "447cf049254621ea",
   "edited": "2026-04-08T12:57:34Z"
  },
  {
   "t": "2026-05-19T14:19:45Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "ee8d96fa43eb0f5dc953dd073640ac8fc2033f19",
   "id": "push:ee8d96fa43eb0f5dc953dd073640ac8fc2033f19"
  },
  {
   "t": "2026-10-23T15:57:51Z",
   "kind": "force_push",
   "who": "maflcko",
   "commit": "1bd568e2c70840f606eab1157b35b1f06dab1e29",
   "id": "push:1bd568e2c70840f606eab1157b35b1f06dab1e29"
  }
 ],
 "labels_log": [
  {
   "t": "2026-02-05T16:58:13Z",
   "action": "labeled",
   "label": "Refactoring",
   "who": "DrahtBot"
  },
  {
   "t": "2026-02-26T13:34:22Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-02-26T14:53:19Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-13T10:27:47Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-13T14:55:23Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-13T16:05:00Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-26T19:48:45Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-03T00:08:26Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-03T10:49:21Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-07T18:45:08Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-05T13:46:12Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-19T16:20:50Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-06T00:37:10Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-10-23T16:00:44Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "maflcko"
  },
  {
   "t": "2026-10-23T16:00:55Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "maflcko"
  },
  {
   "t": "2026-10-23T16:35:14Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-02-05T16:58:12Z",
   "kind": "renamed",
   "who": "DrahtBot",
   "from": " refactor: Add [[nodiscard]] to functions returning bool+mutable ref ",
   "to": "refactor: Add [[nodiscard]] to functions returning bool+mutable ref"
  },
  {
   "t": "2026-03-05T12:35:22Z",
   "kind": "convert_to_draft",
   "who": "maflcko"
  },
  {
   "t": "2026-04-03T14:00:20Z",
   "kind": "ready_for_review",
   "who": "maflcko"
  },
  {
   "t": "2026-04-07T19:14:00Z",
   "kind": "convert_to_draft",
   "who": "maflcko"
  }
 ],
 "text_chars": 9171,
 "text_tokens_estimate": 2292,
 "changed_paths": [
  "src/common/args.h",
  "src/common/config.cpp",
  "src/external_signer.h",
  "src/interfaces/node.h",
  "src/interfaces/wallet.h",
  "src/musig.cpp",
  "src/net_processing.cpp",
  "src/net_processing.h",
  "src/netaddress.h",
  "src/psbt.h",
  "src/qt/addresstablemodel.h",
  "src/script/descriptor.cpp",
  "src/script/descriptor.h",
  "src/script/interpreter.cpp",
  "src/script/script.h",
  "src/script/sign.cpp",
  "src/script/signingprovider.h",
  "src/test/transaction_tests.cpp",
  "src/txdb.cpp",
  "src/wallet/feebumper.h",
  "src/wallet/scriptpubkeyman.h",
  "src/wallet/wallet.h"
 ],
 "files": [
  {
   "path": "src/common/args.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/common/config.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/external_signer.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/interfaces/node.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/interfaces/wallet.h",
   "add": 4,
   "del": 4
  },
  {
   "path": "src/musig.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/net_processing.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/net_processing.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/netaddress.h",
   "add": 3,
   "del": 3
  },
  {
   "path": "src/psbt.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/qt/addresstablemodel.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/script/descriptor.cpp",
   "add": 3,
   "del": 6
  },
  {
   "path": "src/script/descriptor.h",
   "add": 3,
   "del": 3
  },
  {
   "path": "src/script/interpreter.cpp",
   "add": 2,
   "del": 1
  },
  {
   "path": "src/script/script.h",
   "add": 3,
   "del": 3
  },
  {
   "path": "src/script/sign.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/script/signingprovider.h",
   "add": 30,
   "del": 30
  },
  {
   "path": "src/test/transaction_tests.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/txdb.cpp",
   "add": 2,
   "del": 2
  },
  {
   "path": "src/wallet/feebumper.h",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/wallet/scriptpubkeyman.h",
   "add": 10,
   "del": 10
  },
  {
   "path": "src/wallet/wallet.h",
   "add": 2,
   "del": 2
  }
 ],
 "test_lines": 2,
 "git": {
  "head": "1bd568e2c70840f606eab1157b35b1f06dab1e29",
  "head_matches_backup": true,
  "base": "df0dc1e2d2059213e49a9f115fd55a9f0119d26c",
  "patch_id": "253425ad1c6345a7",
  "commits": [
   {
    "sha": "90a82662a9",
    "subject": "refactor: Add [[nodiscard]] to GetOp/GetScriptOp",
    "files": 3,
    "add": 6,
    "del": 5
   },
   {
    "sha": "b7c966e57f",
    "subject": "refactor: Add [[nodiscard]] to GetCachedLastHardenedExtPubKey",
    "files": 2,
    "add": 2,
    "del": 5
   },
   {
    "sha": "1bd568e2c7",
    "subject": "refactor: Add [[nodiscard]] to functions returning bool+mutable ref",
    "files": 19,
    "add": 67,
    "del": 67
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "253425ad1c6345a7",
 "input_hash": "49cd6e6be672c6a7",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}