wallet: Use util::Result for fee bumping methods #37017

Open
rustaceanrob wants to merge 2 commits from refactor-fee-bumper-expected into master AGit
rustaceanrob commented 2026-11-30 09:01:56 +00:00 (Migrated from github.com)

Currently the fee bumping transactions use in/out params and a feebumper::Result type to report error status. This is emulating util::Result and util::Expected. There are also a few problems in the current implementation: There is an error vector passed to each method, but only one error can occupy it at any time. In the case that a transaction cannot be marked as replaced, the error is actually treated as a warning and shown to the user. The INVALID_REQUEST variant is not used.

We can resolve these using the existing util::Result and Expected. This is also required for #35302 in CreateRateBumpTransaction.

Also, one failure case was missing a functional test, which I added here as well

Currently the fee bumping transactions use in/out params and a `feebumper::Result` type to report error status. This is emulating `util::Result` and `util::Expected`. There are also a few problems in the current implementation: There is an error vector passed to each method, but only one error can occupy it at any time. In the case that a transaction cannot be marked as replaced, the error is actually treated as a warning and shown to the user. The `INVALID_REQUEST` variant is not used. We can resolve these using the existing `util::Result` and `Expected`. This is also required for #35302 in `CreateRateBumpTransaction`. Also, one failure case was missing a functional test, which I added here as well
DrahtBot commented 2026-11-30 09:02:05 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK Eunovo, Conradgabe
Concept ACK rkrux

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:

  • #37055 (refactor: drop format calls on strings without arguments by fanquake)
  • #35302 (Silent Payments: Sending (take 2) by Eunovo)

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:

  • src/wallet/types.h: wanrings → warnings [misspelling]
  • src/wallet/types.h: comitting → committing [misspelling]

2026-11-30 09:02:16

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/37017 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/37017.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/37017#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [Eunovo](https://github.com/bitcoin/bitcoin/pull/37017#pullrequestreview-6109978198), [Conradgabe](https://github.com/bitcoin/bitcoin/pull/37017#issuecomment-7283121535) | | Concept ACK | [rkrux](https://github.com/bitcoin/bitcoin/pull/37017#issuecomment-7349135528) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#37055](https://github.com/bitcoin/bitcoin/pull/37055) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/37055.svg"></sub> (refactor: drop format calls on strings without arguments by fanquake) * [#35302](https://github.com/bitcoin/bitcoin/pull/35302) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35302.svg"></sub> (Silent Payments: Sending (take 2) by Eunovo) 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. <!--5faf32d7da4f0f540f40219e4f7537a3--> ### LLM Linter (✨ experimental) Possible typos and grammar issues: - `src/wallet/types.h`: `wanrings` → `warnings` [misspelling] - `src/wallet/types.h`: `comitting` → `committing` [misspelling] <sup>2026-11-30 09:02:16</sup>
First-time contributor

🔵 Suggestion · MarkReplaced failure lacks success-with-warning coverage

The refactor changes the warning representation, but no test checks that a failed MarkReplaced still returns the replacement txid and RPC errors rather than an exception.

Location: src/wallet/rpc/spend.cpp:1162 (head).

Review coverage was incomplete.


Reviewed: 1f31ecd81b1e · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:312ddb2095238aa2ca395a9cc39b05ab5a38a7177afbdb0d69098df9c3e0bef9:9a7f127b15c6116c267953d38288a9f17ec7c7bcd3a975fb71a2db8bfd974dbf --> <!-- ralph-base:afedb19cca4c3b40d89514fb0c66b0c20e4f5d62 --> <!-- ralph-head:1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b --> <!-- ralph-case:5d844d3623e60b672d42a89cb58ae697c9bdcdd142ec7355ab5ea7b3ea201b3d --> **🔵 Suggestion · `MarkReplaced` failure lacks success-with-warning coverage** The refactor changes the warning representation, but no test checks that a failed `MarkReplaced` still returns the replacement txid and RPC `errors` rather than an exception. Location: [`src/wallet/rpc/spend.cpp:1162`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b/src/wallet/rpc/spend.cpp#L1162>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`1f31ecd81b1e`](<https://git.fish.foo/bitcoin/bitcoin/commit/1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b>) · [Review report](<https://review.fish.foo/report/37017-1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b-3328-1.html>) · [Previous reports](<https://review.fish.foo/traces/37017/>) [permalink](<https://review.fish.foo/report/37017-1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b-3328-1.html>)
Eunovo (Migrated from github.com) approved these changes 2026-11-30 10:37:11 +00:00
Eunovo (Migrated from github.com) left a comment
ACK https://github.com/bitcoin/bitcoin/pull/37017/commits/1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b
Eunovo (Migrated from github.com) commented 2026-11-30 09:52:54 +00:00
https://github.com/bitcoin/bitcoin/pull/37017/commits/699ca17170debaeeb5b3a03d35a9f5a09af1b63d: Verified that this test fails if these lines https://github.com/bitcoin/bitcoin/blob/afedb19cca4c3b40d89514fb0c66b0c20e4f5d62/src/wallet/feebumper.cpp#L182-L185 are commented out.
Conradgabe commented 2026-11-30 15:30:52 +00:00 (Migrated from github.com)

tACK 1f31ecd81b

Confirmed wallet_bumpfee.py passes at 699ca17170 and 1f31ecd81b, and feebumper_tests passes at the head, also tested bumpfee on regtest and it passed (both a successful bump and an unknown txid returning error -5)

tACK 1f31ecd81b1ebadf26e484e3114f6bcc79a6da2b Confirmed `wallet_bumpfee.py` passes at 699ca17170 and 1f31ecd81b, and `feebumper_tests` passes at the head, also tested `bumpfee` on regtest and it passed (both a successful bump and an unknown txid returning error -5)
rkrux commented 2026-12-02 14:47:11 +00:00 (Migrated from github.com)

Strong Concept ACK - this kind of code refactor (cleanup) is desired.

Strong Concept ACK - this kind of code refactor (cleanup) is desired.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!37017
No description provided.