-
Notifications
You must be signed in to change notification settings - Fork 37.7k
wallet/refactor: change PSBTError to PSBTResult and remove std::optional<common::PSBTResult> and return common::PSBTResult #32958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32958. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
4786148
to
0748f9b
Compare
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
1a246a9
to
a92955d
Compare
There was a problem hiding this 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.
src/qt/psbtoperationsdialog.cpp
Outdated
@@ -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)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename err
-> result
There was a problem hiding this comment.
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/{}
a92955d
to
d242c75
Compare
There was a problem hiding this 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.
Description
This is a follow-up to #31622 (comment) and #31622 (comment)
What this changes
Updates
PSBTError
toPSBTResult
because we now have
PSBTResult::OK
Updates
PSBTErrorString
toPSBTResultString
Updates
RPCErrorFromPSBTError
toRPCErrorFromPSBTResult
Removes
std::optional<common::PSBTResult>
and instead returns justcommon::PSBTResult
replacing when we return
null
withPSBTResult::OK