Skip to content

Conversation

kevkevinpal
Copy link
Contributor

Description

This is a follow-up to #31622 (comment) and #31622 (comment)

What this changes

  • Updates PSBTError to PSBTResult
    because we now have PSBTResult::OK

  • Updates PSBTErrorString to PSBTResultString

  • Updates RPCErrorFromPSBTError to RPCErrorFromPSBTResult

  • Removes std::optional<common::PSBTResult> and instead returns just common::PSBTResult
    replacing when we return null with PSBTResult::OK

PSBTError now contains the PSBTError::Ok type which means it makes sense
to rename it into PSBTResult since there is a case where it does not
error
@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 13, 2025

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/32958.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK naiyoma

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #33008 (wallet: support bip388 policy with external signer by Sjors)
  • #32983 (rpc: refactor: use string_view in Arg/MaybeArg by stickies-v)
  • #32876 (refactor: use options struct for signing and PSBT operations by Sjors)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)

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.

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Task ARM, unit tests, no functional tests: https://github.com/bitcoin/bitcoin/runs/45878284919
LLM reason (✨ experimental): The CI failure is caused by compilation errors due to incorrect handling of PSBTResult objects in psbtoperationsdialog.cpp.

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.

Copy link
Contributor

@naiyoma naiyoma left a comment

Choose a reason for hiding this comment

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

Concept ACK

l have looked at 87736a9, 5959096 and 125431e changes, LGTM

makes sense to rename since PSBTError::OK is not an error.

PSBTError is consistent with TransactionError, https://github.com/bitcoin/bitcoin/blob/master/src/node/types.h#L24 so maybe TransactionError should also be renamed in a follow-up PR.

@@ -62,7 +62,7 @@ void PSBTOperationsDialog::openWithPSBT(PartiallySignedTransaction psbtx)
const auto err{m_wallet_model->wallet().fillPSBT(std::nullopt, /*sign=*/false, /*bip32derivs=*/true, &n_could_sign, m_transaction_data, complete)};
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename err -> result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! pushed an update in d242c75

PSBTResult has an enum value of OK, so it makes sense to return OK
insead of a {}. This change makes it so we check for an OK value instead
of null/{}
@kevkevinpal kevkevinpal force-pushed the PSBTErrorToPSBTResult branch from a92955d to d242c75 Compare August 11, 2025 19:04
Copy link
Contributor

@naiyoma naiyoma left a comment

Choose a reason for hiding this comment

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

utack d242c75
Haven't done thorough testing yet, but returning an explicit PSBTResult::OK when there's no error is clearer and more optimal than using an optional wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants