Skip to content

Refactor: Updated TransactionError to use util::Expected and removed TransactionError:OK - #35105

Closed
kevkevinpal wants to merge 2 commits into
bitcoin:masterfrom
kevkevinpal:TransactionErrorToTransactionResponse
Closed

kevkevinpal wants to merge 2 commits into
bitcoin:masterfrom
kevkevinpal:TransactionErrorToTransactionResponse

Conversation

@kevkevinpal

@kevkevinpal kevkevinpal commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Similar to #32958 and motivated by #32958 (review)

We now are using util::Expected and removed TransactionError::OK

This makes the enum less confusing because it no longer includes OK.

@DrahtBot

DrahtBot commented Apr 18, 2026 •

Copy link
Copy Markdown
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/35105.

Reviews

See the guideline for information on the review process.

Type Reviewers
Approach NACK janb84

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #35728 (rpc: Properly throw on internal I/O errors in GetTransaction by maflcko)
  • #35511 (RFC: consensus: Make CAmount a class by hodlinator)
  • #34075 (fees: Introduce Mempool Based Fee Estimation to reduce overestimation by ismaelsadeeq)
  • #29278 (Wallet: Add maxfeerate wallet startup option by ismaelsadeeq)

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.

@janb84 janb84 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach NACK

I do not think this is the best future proof way to accomplish the goal. In C++ 23 std::expected is introduced, which is a better way (imo) to do for explicit error handling. E.g link link2

Yes we are currently on C++ 20 but a "polyfill" std::expected is already introduced in the code as util::Expected<T, E>

This makes the upgrade path to C++23 an easy search and replace and is a better way to do explicit error handling / remove the ok from the errors.

@kevkevinpal

Copy link
Copy Markdown
Contributor Author

@janb84 thanks for the review!

I agree and I pushed 592a833 to instead use util::Expected.

Feel free to give this another look and let me know if it seems fine to you

@kevkevinpal

Copy link
Copy Markdown
Contributor Author

rebased and fixed conflicts to 1bcea55

@DrahtBot

DrahtBot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/26795995122/job/78992358839
LLM reason (✨ experimental): CI failed because IWYU detected missing headers and intentionally failed after modifying src/node/interfaces.cpp (added #include <util/expected.h>).

Hints

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.

@DrahtBot

Copy link
Copy Markdown
Contributor

Maybe turn into draft while CI is red?

@kevkevinpal
kevkevinpal force-pushed the TransactionErrorToTransactionResponse branch from 1bcea55 to 78a2b0d Compare June 12, 2026 20:08
@DrahtBot

Copy link
Copy Markdown
Contributor

Maybe turn into draft while CI is red?

@DrahtBot
DrahtBot marked this pull request as draft June 19, 2026 08:45
@DrahtBot

Copy link
Copy Markdown
Contributor

Converted to draft, due to failing CI

@kevkevinpal
kevkevinpal force-pushed the TransactionErrorToTransactionResponse branch from 78a2b0d to 9b53586 Compare June 28, 2026 22:51
@kevkevinpal
kevkevinpal marked this pull request as ready for review June 28, 2026 22:51
@DrahtBot
DrahtBot marked this pull request as draft June 30, 2026 18:54
@fanquake

Copy link
Copy Markdown
Member

Similar to #35201, I'm going to close this for now, given it's been draft, and had failing CI, and no real review. It's also conflicting with things tagged for 32.x, like #34075.

@fanquake fanquake closed this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants