warning
variable was unused in upgradewallet
so I removed it
warning
variable was unused in upgradewallet
so I removed it
4437@@ -4438,7 +4438,9 @@ static RPCHelpMan upgradewallet()
4438 {
4439 {"version", RPCArg::Type::NUM, /* default */ strprintf("%d", FEATURE_LATEST), "The version number to upgrade to. Default is the latest wallet version"}
4440 },
4441- RPCResults{},
4442+ RPCResult{
4443+ RPCResult::Type::STR, "Error", "error description during upgrading wallet"
Would be good to return an object instead. See
0doc/developer-notes.md:- Try to make the RPC response a JSON object.
str
to object
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. (you could split it into two commits within this same PR maybe)
Do you suggest one commit as doc update and another as removal of unused field?
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. (you could split it into two commits within this same PR maybe)
Fixed!
4467- std::vector<bilingual_str> warnings;
4468- if (!pwallet->UpgradeWallet(version, error, warnings)) {
4469+ if (!pwallet->UpgradeWallet(version, error)) {
4470 throw JSONRPCError(RPC_WALLET_ERROR, error.original);
4471 }
4472 return error.original;
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.
There’s the doc update and the warnings unused field removal that make sense individually, but don’t have much in common.
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.
upgradewallet
had been in a previous release. I agree that we should fix the return format now to avoid a breaking RPC interface change.
@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.
Ah. For some reason I thought that
upgradewallet
had been in a previous release. I agree that we should fix the return format now to avoid a breaking RPC interface change.@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 documentation
and one for changing the return type
?
4437@@ -4438,7 +4438,12 @@ static RPCHelpMan upgradewallet()
4438 {
4439 {"version", RPCArg::Type::NUM, /* default */ strprintf("%d", FEATURE_LATEST), "The version number to upgrade to. Default is the latest wallet version"}
4440 },
4441- RPCResults{},
4442+ RPCResult{
4443+ RPCResult::Type::OBJ, "", "",
4444+ {
4445+ {RPCResult::Type::STR, "Error", "error description during upgrading wallet"}
analyzepsbt
4469+ if (!pwallet->UpgradeWallet(version, error)) {
4470 throw JSONRPCError(RPC_WALLET_ERROR, error.original);
4471 }
4472- return error.original;
4473+ UniValue obj(UniValue::VOBJ);
4474+ obj.pushKV("error", error.original);
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, 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.
@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.
Done! Could you please check and verify?
@stackman27 you may like to include the suggested changes from #20282 (review) in this PR too
Done! Could you please verify?
4484 if (!error.empty()) {
4485 obj.pushKV("error", error.original);
4486+ } else {
4487+ if(!request.params[0].isNull()) {
4488+ obj.pushKV("result", "The wallet was upgraded successfully to version 169900.");
4489+ }
ACK 963696288955dc31b3a4fd136bfb791a9d99755b: diff looks correct
Thanks for removing unused stuff.