-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
|
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 copy-paste 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. LLM Linter (✨ experimental)Possible places where named args for integral literals may be used (e.g.
No suggestions were made for calls that already use named comments for the literals or where the literal is among the first two arguments. 2025-12-31 |
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
naiyoma
left a comment
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 87736a986d510e1ea72dfa7051284b3335d124a0, 595909674ea70c34363053831ffc633975605865 and 125431e6afaf10816a09c6ba6a41c2af086b5558 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 d242c75c5c0eb7d5515cc99fda39ff98a6fdd5af
a92955d to
d242c75
Compare
naiyoma
left a comment
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 d242c75c5c0eb7d5515cc99fda39ff98a6fdd5af
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.
d242c75 to
86d9a82
Compare
TumaBitcoiner
left a comment
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.
I made some suggestions to keep consistency between naming and files. Sometimes result was used, other times err.
4e038c4 to
5c69aca
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. |
02c8c5d to
a8c4145
Compare
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
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/{}
Since changing PSBTError -> PSBTResult it makes sense to change the variable names to reflect that it is not always an error and sometimes can have the value of OK
a8c4145 to
dd51b84
Compare
|
rebased to dd51b84 |
Description
This is a follow-up to #31622 (comment) and #31622 (comment)
What this changes
Updates
PSBTErrortoPSBTResultbecause we now have
PSBTResult::OKUpdates
PSBTErrorStringtoPSBTResultStringUpdates
RPCErrorFromPSBTErrortoRPCErrorFromPSBTResultRemoves
std::optional<common::PSBTResult>and instead returns justcommon::PSBTResultreplacing when we return
nullwithPSBTResult::OK