-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Wallet: do not return warnings from UpgradeWallet() #20139
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
Conversation
src/wallet/rpcwallet.cpp
Outdated
@@ -4438,7 +4438,9 @@ static RPCHelpMan upgradewallet() | |||
{ | |||
{"version", RPCArg::Type::NUM, /* default */ strprintf("%d", FEATURE_LATEST), "The version number to upgrade to. Default is the latest wallet version"} | |||
}, | |||
RPCResults{}, | |||
RPCResult{ | |||
RPCResult::Type::STR, "Error", "error description during upgrading wallet" |
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.
Would be good to return an object instead. See
doc/developer-notes.md:- Try to make the RPC response a JSON object.
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.
RPC Result changed from str
to object
7348d82
to
c370e82
Compare
ACK c370e82 |
I think this is a fairly confusing combination of changes in one commit. There's the doc update and the warnings unused field removal that make sense individually, but don't have much in common. |
Do you suggest one commit as doc update and another as removal of unused field? |
97d16f2
to
627f57c
Compare
Fixed! |
Code review ACK d218f9e |
src/wallet/rpcwallet.cpp
Outdated
bilingual_str error; | ||
std::vector<bilingual_str> warnings; | ||
if (!pwallet->UpgradeWallet(version, error, warnings)) { | ||
if (!pwallet->UpgradeWallet(version, error)) { | ||
throw JSONRPCError(RPC_WALLET_ERROR, error.original); | ||
} | ||
return error.original; |
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.
This is not an object what is returned here
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.
so should I have UpgradeWallet
return an object? I'm a little confused
NACK, this doesn't make sense to me as-is. And even if we don't have any warnings today, it might be nice to keep the interface in case we do later. |
Weak Concept NACK. I lean to agree with @luke-jr about keeping (yet unused) warnings in the interface. |
Why? If they are kept you'd have to return an always empty warnings array. Otherwise, it will get used in the future and surely it will be forgotten to update the RPC method to return the warnings. |
Concept ACK removing unused code. |
I agree with this. This should be split into two PRs. I think we can remove the 0.21 milestone. This isn't a bugfix and doesn't need to included in the next release. |
Changing the return type is a breaking change if done after the 0.21 release. I don't see why such a trivial fix should pushed back. |
Ah. For some reason I thought that @stackman27 - I've fixed up the return value and tests (as well as cleaned up the commit logs) here: https://github.com/jnewbery/bitcoin/tree/pr20139.1. Feel free to take that branch. |
Should I have 2 different commits or 2 different PR's one for |
Both commits in this PR is fine |
d218f9e
to
f922fc8
Compare
src/wallet/rpcwallet.cpp
Outdated
RPCResult{ | ||
RPCResult::Type::OBJ, "", "", | ||
{ | ||
{RPCResult::Type::STR, "Error", "error description during upgrading wallet"} |
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.
No need to return an error if there is none. Please make this optional like in analyzepsbt
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.
Done!
32a1aea
to
f3a9928
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 c93f2ac
src/wallet/rpcwallet.cpp
Outdated
throw JSONRPCError(RPC_WALLET_ERROR, error.original); | ||
} | ||
return error.original; | ||
UniValue obj(UniValue::VOBJ); | ||
obj.pushKV("error", error.original); |
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.
This is not optionally pushed
@stackman27, since we need the Return object from upgradewallet RPC for 0.21, I've pulled it into a separate PR #20282 and addressed Marco's review comment. You can use this PR for the Remove unused warning parameter in UpgradeWallet() commit, which doesn't require the 0.21 milestone. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
793efcb
to
bca5420
Compare
Done! Could you please check and verify? |
@stackman27 you may like to include the suggested changes from #20282 (review) in this PR too |
review ACK bca5420 |
a6853cc
to
e72d8c5
Compare
Done! Could you please verify? |
e72d8c5
to
481f640
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 on just removing the unused warnings. Will re-review after update.
src/wallet/rpcwallet.cpp
Outdated
} else { | ||
if(!request.params[0].isNull()) { | ||
obj.pushKV("result", "The wallet was upgraded successfully to version 169900."); | ||
} |
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 think this addition can be dropped along with the test change (see also #20403, and apologies--I didn't realize you were working on this until DrahtBot mentioned it).
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.
okay so I'll just take the result object out
481f640
to
9636962
Compare
ACK 9636962: diff looks correct Thanks for removing unused stuff. |
review ACK 9636962 |
ACK 9636962 |
9636962 [upgradewallet] removed unused warning param (Sishir Giri) Pull request description: The `warning` variable was unused in `upgradewallet` so I removed it ACKs for top commit: practicalswift: ACK 9636962: diff looks correct MarcoFalke: review ACK 9636962 jonatack: ACK 9636962 Tree-SHA512: 1d63186ce1e05e86a778340f2d7986c2cee1523de0a11cea39e8d148ac7ee26c49741dfa302b5c1cd1c8d74e67c1f9baee2763720c2d850b57da9a3fdce24565
Summary: This is a backport of [[bitcoin/bitcoin#20139 | core#20139]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10734
The
warning
variable was unused inupgradewallet
so I removed it