kernel, refactor: return error status on all fatal errors #29700

pull ryanofsky wants to merge 23 commits into bitcoin:master from ryanofsky:pr/fatalresult changing 54 files +1722 −663
  1. ryanofsky commented at 11:11 pm on March 21, 2024: contributor

    Return util::Result objects from all functions that can trigger fatal errors.

    There are many validation functions that handle failures by calling AbortNode and triggering shutdowns, without returning error information to their callers. This makes error handling in libbitcoinkernel application code difficult, because the only way to handle these errors is to register for notification callbacks. Improve this by making all functions that trigger fatal errors return util::Result objects with the error information.

    This PR is a pure refactoring that returns extra result information from functions without changing their behavior. It’s a possible alternative to and subset of #29642, which adds similar return information but also makes behavior changes and exposes a FatalError type.


    This is based on #25665. The non-base commits are:

  2. DrahtBot commented at 11:11 pm on March 21, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/29700.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34589 (ci: Temporarily use clang in valgrind tasks by maflcko)
    • #34544 (wallet: Disallow wallet names that are paths including .. and . elements by achow101)
    • #34521 (validation: fix UB in LoadChainTip by marcofleon)
    • #34439 (qa: Drop recursive deletes from test code, add lint checks. by davidgumberg)
    • #34435 (refactor: use _MiB/_GiB consistently for byte conversions by l0rinc)
    • #34271 (net_processing: make m_tx_for_private_broadcast optional by vasild)
    • #34208 (bench: add fluent API for untimed setup steps in nanobench by l0rinc)
    • #34184 (mining: add cooldown to createNewBlock() immediately after IBD by Sjors)
    • #34132 (coins: drop error catcher, centralize fatal read handling by l0rinc)
    • #34004 (Implementation of SwiftSync by rustaceanrob)
    • #33966 (refactor: disentangle miner startup defaults from runtime options by Sjors)
    • #33854 (fix assumevalid is ignored during reindex by Eunovo)
    • #33512 (coins: use number of dirty cache entries in flush warnings/logs by l0rinc)
    • #33421 (node: add BlockTemplateCache by ismaelsadeeq)
    • #33324 (blocks: add -reobfuscate-blocks argument to enable (de)obfuscating existing blocks by l0rinc)
    • #32950 (validation: remove BLOCK_FAILED_CHILD by stratospher)
    • #32554 (bench: replace embedded raw block with configurable block generator by l0rinc)
    • #32317 (kernel: Separate UTXO set access from validation functions by sedited)
    • #32061 (Replace libevent with our own HTTP and socket-handling implementation by pinheadmz)
    • #31382 (kernel: Flush in ChainstateManager destructor by sedited)
    • #31132 (validation: fetch block inputs on parallel threads 3x faster IBD by andrewtoth)
    • #30342 (kernel, logging: Pass Logger instances to kernel objects by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • “helper functions types” -> “helper functions and types” [the phrase as written is ungrammatical; it likely intends to say both helper functions and types]
    • “to for dealing” -> “for dealing” (or “to deal”) [contains both “to” and “for”; one should be removed to form a valid phrase]

    2026-03-02 15:41:30

  3. ryanofsky marked this as a draft on Mar 21, 2024
  4. DrahtBot added the label CI failed on Mar 22, 2024
  5. DrahtBot commented at 0:41 am on March 22, 2024: contributor

    🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

    Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    Leave a comment here, if you need help tracking down a confusing failure.

    Debug: https://github.com/bitcoin/bitcoin/runs/22957677751

  6. DrahtBot added the label Needs rebase on Mar 22, 2024
  7. Graysonbarton approved
  8. Graysonbarton commented at 2:52 pm on March 25, 2024: none
    Fixing fatal errors.
  9. ryanofsky force-pushed on Mar 26, 2024
  10. DrahtBot removed the label Needs rebase on Mar 26, 2024
  11. ryanofsky force-pushed on Mar 26, 2024
  12. ryanofsky force-pushed on Mar 26, 2024
  13. ryanofsky force-pushed on Mar 27, 2024
  14. ryanofsky force-pushed on Mar 27, 2024
  15. DrahtBot added the label Needs rebase on Mar 28, 2024
  16. ryanofsky force-pushed on Mar 28, 2024
  17. DrahtBot removed the label Needs rebase on Mar 28, 2024
  18. DrahtBot added the label Needs rebase on Apr 11, 2024
  19. ryanofsky force-pushed on Apr 18, 2024
  20. DrahtBot removed the label Needs rebase on Apr 18, 2024
  21. ryanofsky force-pushed on Apr 26, 2024
  22. DrahtBot added the label Needs rebase on Apr 30, 2024
  23. ryanofsky force-pushed on May 1, 2024
  24. ryanofsky commented at 5:53 pm on May 1, 2024: contributor
    Rebased 4d2c9de24916f8d69514ea7c7251136e2762fa5c -> f65fa8c91130931713848a97606d5add0fc9b8c5 (pr/fatalresult.13 -> pr/fatalresult.14, compare) due to silent conflict with #28970
  25. DrahtBot removed the label Needs rebase on May 1, 2024
  26. DrahtBot added the label Needs rebase on May 13, 2024
  27. ryanofsky force-pushed on Jun 17, 2024
  28. DrahtBot removed the label Needs rebase on Jun 17, 2024
  29. ryanofsky force-pushed on Jun 18, 2024
  30. DrahtBot commented at 8:43 am on June 19, 2024: contributor

    https://cirrus-ci.com/task/4621016628985856?logs=ci#L3516

    0 test  2024-06-18T23:26:56.881000Z TestFramework (ERROR): Assertion failed 
    1                                   Traceback (most recent call last):
    2                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 132, in main
    3                                       self.run_test()
    4                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/feature_pruning.py", line 447, in run_test
    5                                       self.reorg_back()
    6                                     File "/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/feature_pruning.py", line 231, in reorg_back
    7                                       assert not self.nodes[2].verifychain(checklevel=4, nblocks=0)
    8                                   AssertionError
    
  31. ryanofsky force-pushed on Jun 20, 2024
  32. DrahtBot added the label Needs rebase on Jun 25, 2024
  33. ryanofsky force-pushed on Jul 10, 2024
  34. ryanofsky commented at 5:45 pm on July 10, 2024: contributor
    Rebased 692fc11f0aae3c8013f6f01d133139ce8eba7135 -> ad1e73590d102edf3738986c1382b5e36a0ed727 (pr/fatalresult.17 -> pr/fatalresult.18, compare) to fix conflicts
  35. DrahtBot removed the label CI failed on Jul 10, 2024
  36. DrahtBot removed the label Needs rebase on Jul 10, 2024
  37. DrahtBot added the label Needs rebase on Jul 10, 2024
  38. ryanofsky force-pushed on Jul 18, 2024
  39. ryanofsky commented at 6:20 pm on July 18, 2024: contributor
    Rebased ad1e73590d102edf3738986c1382b5e36a0ed727 -> e04e259146238f9a733edf3fd7b192db95f66e71 (pr/fatalresult.18 -> pr/fatalresult.19, compare) to fix conflicts with #29668 and #30428
  40. DrahtBot removed the label Needs rebase on Jul 18, 2024
  41. DrahtBot commented at 9:46 pm on July 18, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/27631437225

    Make sure to run all tests locally, according to the documentation.

    The failure may happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  42. DrahtBot added the label CI failed on Jul 18, 2024
  43. ryanofsky force-pushed on Jul 19, 2024
  44. DrahtBot removed the label CI failed on Jul 19, 2024
  45. DrahtBot added the label Needs rebase on Jul 26, 2024
  46. in src/node/blockstorage.cpp:509 in e22926a383 outdated
    507 {
    508-    if (!LoadBlockIndex(snapshot_blockhash)) {
    509-        return false;
    510+    auto result{LoadBlockIndexData(snapshot_blockhash)};
    511+    if (!result || IsInterrupted(*result)) {
    512+        return result;
    


    maflcko commented at 2:33 pm on July 26, 2024:
    Seems fragile to use util::Result<InterruptResult>. Wrapping one result into another is fragile, because call-sites may easily forget to unwrap the inner result, especially if the inner result is otherwise void. My recommendation would be to treat interruption as util::Error, so that callers don’t miss it if they check for errors (but forget to check for interruption), but are free to check it, if they inspect the precise error.

    ryanofsky commented at 6:27 pm on August 7, 2024:

    re: #29700 (review)

    Seems fragile to use util::Result<InterruptResult>. Wrapping one result into another is fragile, because call-sites may easily forget to unwrap the inner result, especially if the inner result is otherwise void. My recommendation would be to treat interruption as util::Error, so that callers don’t miss it if they check for errors (but forget to check for interruption), but are free to check it, if they inspect the precise error.

    It sounds like you want Result<InterruptResult, void> to be replaced with Result<void, InterruptResult> which would be ok with me. I don’t think the difference between these things is very significant, but I agree maybe if the caller forgets to check for the interrupted status, incorrectly treating the interrupted status like a failure might be safer than incorrectly treating the interrupted status like a success.

  47. ryanofsky force-pushed on Aug 7, 2024
  48. ryanofsky commented at 6:39 pm on August 7, 2024: contributor
    Rebased e22926a383223b286fe97a12ea4efaa81414bb41 -> 3ab9a46ac67964c9d5ad54120b680b5eee7f16f0 (pr/fatalresult.20 -> pr/fatalresult.21, compare) due to conflicts with #30517 and #30497
  49. DrahtBot added the label CI failed on Aug 7, 2024
  50. DrahtBot removed the label Needs rebase on Aug 7, 2024
  51. DrahtBot added the label Needs rebase on Aug 9, 2024
  52. sedited commented at 3:19 pm on October 31, 2024: contributor
    Can you rebase this?
  53. ryanofsky force-pushed on Nov 4, 2024
  54. ryanofsky commented at 1:28 pm on November 4, 2024: contributor

    Rebased 3ab9a46ac67964c9d5ad54120b680b5eee7f16f0 -> 05438605ba95df14705bf2f57924455f3b2e40e1 (pr/fatalresult.21 -> pr/fatalresult.22, compare) due to various conflicts. Still have not moved InterruptResult from success type to failure type yet (https://github.com/bitcoin/bitcoin/pull/29700#discussion_r1707623223), but would like to try that Updated 05438605ba95df14705bf2f57924455f3b2e40e1 -> 37edd648608b35ee8647b24a2810cb68318d0e88 (pr/fatalresult.22 -> pr/fatalresult.23, compare) to fix feature_assumeutxo.py errors https://github.com/bitcoin/bitcoin/actions/runs/11665121674/job/32477102140?pr=29700 Updated 37edd648608b35ee8647b24a2810cb68318d0e88 -> c8b555b18dc149f43f3fffdff7962c3e69e655a9 (pr/fatalresult.23 -> pr/fatalresult.24, compare) to fix windows stderr line ending error https://github.com/bitcoin/bitcoin/actions/runs/11667772974/job/32485867701#step:12:131 Updated c8b555b18dc149f43f3fffdff7962c3e69e655a9 -> a1077c21dd8995c5f11a56b65432da759a3c1b8e (pr/fatalresult.24 -> pr/fatalresult.25, compare) to fix windows errors caused by previous fix (https://github.com/bitcoin/bitcoin/actions/runs/11674634334/job/32507680468) Rebased a1077c21dd8995c5f11a56b65432da759a3c1b8e -> af226a6a39ebab9d5886fcccdfbe63ea7da4fd9e (pr/fatalresult.25 -> pr/fatalresult.26, compare) due to various conflicts Rebased af226a6a39ebab9d5886fcccdfbe63ea7da4fd9e -> 63aa292c8e68c51cf49baba799cbb6aa573dec82 (pr/fatalresult.26 -> pr/fatalresult.27, compare) due to conflict with #31072 Rebased 63aa292c8e68c51cf49baba799cbb6aa573dec82 -> 07d8ec809e10872e5bf3c870abab365bdcb9adba (pr/fatalresult.27 -> pr/fatalresult.28, compare) due to conflicts with #31490, #30965, and #31439 Rebased 07d8ec809e10872e5bf3c870abab365bdcb9adba -> b795ab78b725c3ece4a5aca40330724e4929bc7f (pr/fatalresult.28 -> pr/fatalresult.29, compare) due to conflict with #32033 Rebased b795ab78b725c3ece4a5aca40330724e4929bc7f -> 42a73b451cd68be443c7a0dd94f7a00477775e23 (pr/fatalresult.29 -> pr/fatalresult.30, compare) due to silent conflict with #31910 causing nodiscard error https://cirrus-ci.com/task/5763662914256896 Rebased 42a73b451cd68be443c7a0dd94f7a00477775e23 -> f169e600c0868f96acf42bc3847acfa220db925d (pr/fatalresult.30 -> pr/fatalresult.31, compare) due to various conflicts Rebased f169e600c0868f96acf42bc3847acfa220db925d -> a4cf35ddbde791e491375217470649c0e844955b (pr/fatalresult.31 -> pr/fatalresult.32, compare) due to conflict with #31385

    Updated a4cf35ddbde791e491375217470649c0e844955b -> 3c4b28b4d8072abd07405ffbe18c16de7c9d0a86 (pr/fatalresult.32 -> pr/fatalresult.33, compare) to fix ci lint and tidy errors https://cirrus-ci.com/task/6460361353723904 https://cirrus-ci.com/task/5052986470170624

    Rebased 3c4b28b4d8072abd07405ffbe18c16de7c9d0a86 -> b1136354d6d7d195bfda2eb3b9bdf79f87cef3bf (pr/fatalresult.33 -> pr/fatalresult.34, compare)

    Rebased b1136354d6d7d195bfda2eb3b9bdf79f87cef3bf -> aa57da149017205d4e0df201c8c301d520fc17d6 (pr/fatalresult.34 -> pr/fatalresult.35, compare) due to conflict with #30595

    Rebased aa57da149017205d4e0df201c8c301d520fc17d6 -> 2bc7da5ec86c1174ade3e908b2844822019acf8f (pr/fatalresult.35 -> pr/fatalresult.36, compare)

    Rebased 2bc7da5ec86c1174ade3e908b2844822019acf8f -> 15fa85163f324d50f6365b1865c320c974bcc3ee (pr/fatalresult.36 -> pr/fatalresult.37, compare)

    Rebased 15fa85163f324d50f6365b1865c320c974bcc3ee -> f4e0a7d5eb59c6e74c2e3c2f0e7992251303975a (pr/fatalresult.37 -> pr/fatalresult.38, compare) due to conflicts

    Updated f4e0a7d5eb59c6e74c2e3c2f0e7992251303975a -> 642e3a5b21b81317ad1a78a83456f0a2bbcd0fb9 (pr/fatalresult.38 -> pr/fatalresult.39, compare) to fix CI errors https://github.com/bitcoin/bitcoin/actions/runs/21052613538

    Updated 642e3a5b21b81317ad1a78a83456f0a2bbcd0fb9 -> 871651378ca0af03365040f60858a2939e4bdf68 (pr/fatalresult.39 -> pr/fatalresult.40, compare) to fix CI error https://github.com/bitcoin/bitcoin/actions/runs/21078196842/job/60625273966?pr=29700

    Rebased 871651378ca0af03365040f60858a2939e4bdf68 -> 75e142acf994773d7693a63e53193cd342dab78e (pr/fatalresult.40 -> pr/fatalresult.41, compare) on top of #25665 pr/bresult2.73 due to conflicts with #34253 and #33680

    Updated 75e142acf994773d7693a63e53193cd342dab78e -> 326c23ab46e24fcf8114439d6e19f23ef1106968 (pr/fatalresult.41 -> pr/fatalresult.42, compare) to fix IWYU errors https://github.com/bitcoin/bitcoin/actions/runs/21643714580/job/62390097850?pr=29700

    Rebased 326c23ab46e24fcf8114439d6e19f23ef1106968 -> ad8f98ceb224324d1d0fd81d45c83d04b1b3e92d (pr/fatalresult.42 -> pr/fatalresult.43, compare) due to conflict with #34504

    Updated ad8f98ceb224324d1d0fd81d45c83d04b1b3e92d -> 09cbe90fa5c05e56d43895948d0d4f2b771cff9f (pr/fatalresult.43 -> pr/fatalresult.44, compare) to fix feature_init.py failure https://github.com/bitcoin/bitcoin/actions/runs/21833788038/job/62998952469?pr=29700 caused by silent conflict with #34241

    Rebased 09cbe90fa5c05e56d43895948d0d4f2b771cff9f -> 8c5593b5110a32ee955bc5926d73aef74c5e99f6 (pr/fatalresult.44 -> pr/fatalresult.45, compare) due to conflicts with #32950, #33512, #34184

    Rebased 8c5593b5110a32ee955bc5926d73aef74c5e99f6 -> 235dd2123953d8fff11abc5102d152635065d3f5 (pr/fatalresult.45 -> pr/fatalresult.46, compare) on top of #25665 pr/bresult2.75 to fix CI failures https://github.com/bitcoin/bitcoin/actions/runs/22557596616/job/65337794687?pr=29700#step:9:862 caused by previous bad conflict resolutions

  55. DrahtBot removed the label Needs rebase on Nov 4, 2024
  56. ryanofsky force-pushed on Nov 4, 2024
  57. DrahtBot removed the label CI failed on Nov 4, 2024
  58. ryanofsky force-pushed on Nov 4, 2024
  59. ryanofsky force-pushed on Nov 5, 2024
  60. DrahtBot added the label Needs rebase on Nov 14, 2024
  61. ryanofsky force-pushed on Dec 6, 2024
  62. ryanofsky force-pushed on Dec 6, 2024
  63. DrahtBot removed the label Needs rebase on Dec 6, 2024
  64. DrahtBot added the label Needs rebase on Dec 13, 2024
  65. ryanofsky force-pushed on Mar 12, 2025
  66. DrahtBot removed the label Needs rebase on Mar 12, 2025
  67. DrahtBot added the label Needs rebase on Mar 17, 2025
  68. ryanofsky force-pushed on Mar 20, 2025
  69. DrahtBot removed the label Needs rebase on Mar 20, 2025
  70. DrahtBot added the label CI failed on Mar 23, 2025
  71. DrahtBot commented at 3:55 pm on March 23, 2025: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/39130149980

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  72. ryanofsky force-pushed on Mar 24, 2025
  73. DrahtBot removed the label CI failed on Mar 24, 2025
  74. DrahtBot added the label Needs rebase on Apr 16, 2025
  75. ryanofsky force-pushed on Aug 1, 2025
  76. ryanofsky force-pushed on Aug 1, 2025
  77. DrahtBot removed the label Needs rebase on Aug 1, 2025
  78. DrahtBot added the label CI failed on Aug 1, 2025
  79. DrahtBot commented at 9:16 pm on August 1, 2025: contributor

    🚧 At least one of the CI tasks failed. Task lint: https://github.com/bitcoin/bitcoin/runs/47214217413 LLM reason (✨ experimental): The CI failure was caused by a trailing whitespace check failure during linting.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  80. ryanofsky force-pushed on Aug 1, 2025
  81. DrahtBot removed the label CI failed on Aug 2, 2025
  82. DrahtBot added the label Needs rebase on Aug 20, 2025
  83. ryanofsky force-pushed on Oct 15, 2025
  84. DrahtBot removed the label Needs rebase on Oct 15, 2025
  85. DrahtBot added the label Needs rebase on Oct 31, 2025
  86. ryanofsky force-pushed on Nov 11, 2025
  87. DrahtBot removed the label Needs rebase on Nov 11, 2025
  88. DrahtBot added the label Needs rebase on Dec 2, 2025
  89. ryanofsky force-pushed on Dec 12, 2025
  90. DrahtBot removed the label Needs rebase on Dec 12, 2025
  91. DrahtBot added the label Needs rebase on Dec 12, 2025
  92. DrahtBot added the label CI failed on Dec 12, 2025
  93. DrahtBot commented at 4:54 pm on December 12, 2025: contributor

    🚧 At least one of the CI tasks failed. Task lint: https://github.com/bitcoin/bitcoin/actions/runs/20166565712/job/57896414033 LLM reason (✨ experimental): Lint failure: a new circular dependency was detected in util/messages/ util/result during the all_python_linters run.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  94. ryanofsky force-pushed on Dec 16, 2025
  95. DrahtBot removed the label Needs rebase on Dec 16, 2025
  96. DrahtBot added the label Needs rebase on Dec 16, 2025
  97. ryanofsky force-pushed on Jan 16, 2026
  98. DrahtBot removed the label Needs rebase on Jan 16, 2026
  99. ryanofsky force-pushed on Jan 16, 2026
  100. ryanofsky force-pushed on Jan 17, 2026
  101. DrahtBot removed the label CI failed on Jan 17, 2026
  102. DrahtBot added the label Needs rebase on Jan 26, 2026
  103. ryanofsky force-pushed on Feb 3, 2026
  104. ryanofsky force-pushed on Feb 3, 2026
  105. DrahtBot added the label CI failed on Feb 3, 2026
  106. DrahtBot commented at 7:33 pm on February 3, 2026: contributor

    🚧 At least one of the CI tasks failed. Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/21643714580/job/62390097850 LLM reason (✨ experimental): CI failure due to IWYU reporting a contentful include issue and returning non-zero, causing the test script to fail.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  107. DrahtBot removed the label Needs rebase on Feb 3, 2026
  108. DrahtBot removed the label CI failed on Feb 3, 2026
  109. DrahtBot added the label Needs rebase on Feb 5, 2026
  110. ryanofsky force-pushed on Feb 9, 2026
  111. DrahtBot removed the label Needs rebase on Feb 9, 2026
  112. DrahtBot added the label CI failed on Feb 9, 2026
  113. ryanofsky force-pushed on Feb 9, 2026
  114. DrahtBot removed the label CI failed on Feb 9, 2026
  115. DrahtBot added the label Needs rebase on Feb 18, 2026
  116. refactor: Add util::Result failure values
    Add util::Result support for returning more error information. For better error
    handling, adds the ability to return a value on failure, not just a value on
    success. This is a key missing feature that made the result class not useful
    for functions like LoadChainstate() which produce different errors that need to
    be handled differently.
    
    This change also makes some more minor improvements:
    
    - Smaller type size. On 64-bit platforms, util::Result<int> is 16 bytes, and
      util::Result<void> is 8 bytes. Previously util::Result<int> and
      util::Result<void> were 72 bytes.
    
    - More documentation and tests.
    36bc060da2
  117. wallet: fix clang-tidy warning performance-no-automatic-move
    Previous commit causes the warning to be triggered, but the suboptimal return
    from const statement was added earlier in 517e204bacd9d.
    
    Warning was causing CI failure https://cirrus-ci.com/task/6159914970644480
    dcd98ef306
  118. refactor: Add util::Result::Update() method
    Add util::Result Update method to make it possible to change the value of an
    existing Result object. This will be useful for functions that can return
    multiple error and warning messages, and want to be able to change the result
    value while keeping existing messages.
    cb2e91be30
  119. refactor: Use util::Result class in LoadChainstate and VerifyLoadedChainstate f95eeb5cb3
  120. refactor: Add util::Result multiple error and warning messages
    Add util::Result support for returning warning messages and multiple errors,
    not just a single error string. This provides a way for functions to report
    errors and warnings in a standard way, and simplifies interfaces.
    
    The functionality is unit tested here, and put to use in followup PR
    https://github.com/bitcoin/bitcoin/pull/25722
    78f39378e0
  121. test: add static test for util::Result memory usage
    Suggested by Martin Leitner-Ankerl <martin.ankerl@gmail.com>
    https://github.com/bitcoin/bitcoin/pull/25722#discussion_r1174298529
    
    Co-authored-by: Martin Leitner-Ankerl <martin.ankerl@gmail.com>
    d91775c8ea
  122. ci: Avoid -Wno-error=maybe-uninitialized false positives
    Avoid false positive maybe-uninitialized errors in
    00_setup_env_native_fuzz_with_valgrind CI jobs. Similar errors also happen in
    00_setup_env_arm and 00_setup_env_win64 jobs.
    
    Problem was pointed out and fix was suggested by maflcko in
    https://github.com/bitcoin/bitcoin/pull/25665#issuecomment-3457573218
    
    CI errors look like:
    https://github.com/bitcoin/bitcoin/actions/runs/18881332233/job/53885646274?pr=25665
    
    /home/admin/actions-runner/_work/_temp/src/wallet/test/util.cpp: In function ‘wallet::DescriptorScriptPubKeyMan* wallet::CreateDescriptor(CWallet&, const std::string&, bool)’:
    /home/admin/actions-runner/_work/_temp/src/wallet/test/util.cpp:213:29: error: ‘*(const std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>*)((char*)&spkm + offsetof(util::Result<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>,util::Result<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>::<unnamed>.util::detail::SuccessHolder<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>::<unnamed>)).std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>::_M_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      213 |     return &spkm.value().get();
          |             ~~~~~~~~~~~~~~~~^~
    /home/admin/actions-runner/_work/_temp/src/wallet/test/util.cpp:212:10: note: ‘*(const std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>*)((char*)&spkm + offsetof(util::Result<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>,util::Result<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>::<unnamed>.util::detail::SuccessHolder<std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>, void, util::Messages>::<unnamed>)).std::reference_wrapper<wallet::DescriptorScriptPubKeyMan>::_M_data’ was declared here
      212 |     auto spkm = Assert(keystore.AddWalletDescriptor(w_desc, keys,/*label=*/"", /*internal=*/false));
          |          ^~~~
    ba5f435034
  123. Merge branch 'pr/bresult2' into pr/fatalresult ec1ae09a1e
  124. refactor, kernel: Add FlushStatus / FlushResult types 97a6c2682f
  125. refactor: Add InfoType field to util::Result
    Add new InfoType field to util::Result which unlike SuccessType and FailureType
    is useful for returning extra information in a result regardless of whether the
    function succeeded for failed.
    
    This will be used to return FlushStatus values from libbitcoinkernel functions
    indicating if flushed data in addition to whether they succeeded or failed.
    
    The InfoType field is stored directly in the util::Result object, unlike
    FailureType and MessagesType which are stored in dynamically allocated memory
    and require an extra memory allocation if they are accessed.
    85277d6251
  126. refactor, blockstorage: Return FlushResult from flush methods
    Return FlushResult instead of bool from BlockStorage FlushUndoFile,
    FlushBlockFile, FlushChainstateBlockFile methods and update all callers of
    these methods to use the FlushResult type internally and provide context
    information for the flush failure. Three callers:
    BlockManager::FindNextBlockPos, BlockManager::WriteUndoDataForBlock, and
    Chainstate::FlushStateToDisk will be updated in upcoming commits to bubble
    results up to their callers.
    771c55b5ec
  127. refactor, blockstorage: Return fatal errors from block writes
    Return fatal errors from BlockManager methods that write block data. Also
    update callers to use the new result types. The callers will be changed to
    bubble up the results to their callers in subsequent commits.
    6923030948
  128. refactor, validation: Switch to result.Update
    Use result.Update in CompleteChainstateInit() and
    ChainstateManager::ActivateSnapshot() so it is possible for them to return
    warning messages (about flush failures) in upcoming commits.
    
    CompleteChainstateInit() was previously changed to use util::Result in #25665
    and ChainstateManager::ActivateSnapshot() was changed to use it in #30267, but
    previously these functions only returned Result values themselves, and did not
    call other functions that return Result values. Now, some functions they are
    calling will also return Result values, so refactor these functions to use
    result.Update so they can merge results and return complete error and warning
    messages.
    13133392c2
  129. refactor, blockstorage: Return fatal error from LoadBlockIndex
    Return fatal error and interrupt status from LoadBlockIndex functions and
    update callers to use new result types.
    5d556d3de7
  130. refactor, validation: Return fatal errors from FlushStateToDisk
    Return fatal errors from the Chainstate::FlushStateToDisk method and several
    small, related methods which wrap it: ForceFlushStateToDisk, PruneAndFlush,
    ResizeCoinsCaches, and MaybeRebalanceCaches.
    
    Also add nodiscard annotations so callers do not accidentally ignore the result
    values. Callers in init and rpc files are updated to explicitly ignore the
    flush results, and other callers (AcceptToMemoryPool, ProcessNewPackage,
    DisconnectTip, ConnectTip, ActivateBestChainStep, ActivateSnapshot,
    MaybeCompleteSnapshotValidation) are updated to store the results in this
    commit, and will be updated in upcoming commits to bubble results up to their
    callers.
    7bca93bb0f
  131. refactor, validation: Return fatal errors from mempool accept functions
    Return fatal errors from AcceptToMemoryPool ProcessNewPackage,
    ProcessTransaction, MaybeUpdateMempoolForReorg, and LoadMempool functions.
    
    Also add nodiscard annotations so callers handle the result values. Two callers
    ActivateBestChainStep and InvalidateBlock will be updated in upcoming commits
    to bubble results up to their callers.
    9058aa68d8
  132. refactor, validation: Return fatal errors from assumeutxo snapshot functions
    Return fatal errors from ActivateSnapshot, MaybeCompleteSnapshotValidation, and
    ValidatedSnapshotCleanup functions. Also add nodiscard annotations so callers
    handle the result values. One caller, ConnectTip, will be updated in an
    upcoming commit to bubble results up to its callers.
    0d4937caab
  133. refactor, validation: Return fatal errors from block connect functions
    Return fatal errors from ConnectBlock, ConnectTip, DisconnectTip, and
    InvalidateBlock. Also add nodiscard annotations so callers handle the result
    values. Three callers: ActivateBestChainStep TestBlockValidity, and
    CVerifyDB::VerifyDB will be updated in upcoming commits to bubble results up
    to their callers.
    7636dc1201
  134. refactor, validation: Return fatal errors from activate best chain functions
    Return fatal errors from ActivateBestChain, ActivateBestChainStep, and
    PreciousBlock functions.  Also add nodiscard annotations so callers handle the
    result values. Two callers, ProcessNewBlock and LoadExternalBlockFile, will be
    updated in an upcoming commits to bubble results up to its callers.
    8f440a7750
  135. refactor, validation: Return fatal errors from new block functions
    Return fatal errors from AcceptBlock, ProcessNewBlock, TestBlockValidity,
    LoadGenesisBlock, and LoadExternalBlockFile. Also add nodiscard annotations so
    callers handle the result values.
    37ceb62284
  136. refactor, blockstorage: Return fatal error from ImportBlocks
    Return fatal error ImportBlocks function and add nodiscard annotation.
    c603fa5800
  137. refactor, validation: Return more errors from VerifyDB
    Return ConnectBlock errors from VerifyDB.
    1e687bd1f0
  138. ci: Avoid -Wno-error=maybe-uninitialized false positives
    Avoid false positive maybe-uninitialized errors in native_previous_releases
    CI job.
    
    Fix was suggested by maflcko in
    https://github.com/bitcoin/bitcoin/pull/25665#issuecomment-3457573218
    
    CI errors look like:
    https://github.com/bitcoin/bitcoin/actions/runs/21052613538/job/60542048502?pr=29700
    
    /usr/include/c++/12/variant:1788:15: error: ‘((const std::__detail::__variant::_Variant_storage<true, VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>::__index_type*)((char*)&verify_result + offsetof(util::Result<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>,util::Result<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>::<unnamed>.util::detail::SuccessHolder<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>::<unnamed>)))[1]’ may be used uninitialized [-Werror=maybe-uninitialized]
     1788 |               switch (__v0.index())
          |               ^~~~~~
    /home/admin/actions-runner/_work/_temp/src/node/chainstate.cpp: In function ‘kernel::FlushResult<std::variant<std::monostate, kernel::Interrupted>, node::ChainstateLoadError> node::VerifyLoadedChainstate(ChainstateManager&, const ChainstateLoadOptions&)’:
    /home/admin/actions-runner/_work/_temp/src/node/chainstate.cpp:281:18: note: ‘((const std::__detail::__variant::_Variant_storage<true, VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>::__index_type*)((char*)&verify_result + offsetof(util::Result<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>,util::Result<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>::<unnamed>.util::detail::SuccessHolder<std::variant<VerifySuccess, kernel::Interrupted, SkippedL3Checks, SkippedMissingBlocks>, void, kernel::FlushStatus, util::Messages>::<unnamed>)))[1]’ was declared here
      281 |             auto verify_result{CVerifyDB(chainman.GetNotifications()).VerifyDB(
          |                  ^~~~~~~~~~~~~
    235dd21239
  139. ryanofsky force-pushed on Mar 2, 2026
  140. DrahtBot added the label CI failed on Mar 2, 2026
  141. DrahtBot commented at 1:35 am on March 2, 2026: contributor

    🚧 At least one of the CI tasks failed. Task test ancestor commits: https://github.com/bitcoin/bitcoin/actions/runs/22557596616/job/65337799865 LLM reason (✨ experimental): Compilation failed due to 17 errors in src/wallet/coinselection.cpp during build.

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  142. DrahtBot removed the label Needs rebase on Mar 2, 2026
  143. ryanofsky force-pushed on Mar 2, 2026
  144. DrahtBot removed the label CI failed on Mar 2, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-03 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me