Skip to content

Conversation

stackman27
Copy link
Contributor

@stackman27 stackman27 commented Oct 12, 2020

The warning variable was unused in upgradewallet so I removed it

@@ -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"
Copy link
Member

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.

Copy link
Contributor Author

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

@maflcko maflcko added this to the 0.21.0 milestone Oct 12, 2020
@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch 2 times, most recently from 7348d82 to c370e82 Compare October 12, 2020 21:37
@achow101
Copy link
Member

ACK c370e82

@laanwj
Copy link
Member

laanwj commented Oct 15, 2020

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)

@stackman27
Copy link
Contributor Author

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?

@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch from 97d16f2 to 627f57c Compare October 19, 2020 00:59
@stackman27
Copy link
Contributor Author

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!

@S3RK
Copy link
Contributor

S3RK commented Oct 22, 2020

Code review ACK d218f9e

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;
Copy link
Member

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

Copy link
Contributor Author

@stackman27 stackman27 Oct 25, 2020

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

@luke-jr
Copy link
Member

luke-jr commented Oct 24, 2020

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.

@hebasto
Copy link
Member

hebasto commented Oct 25, 2020

Weak Concept NACK. I lean to agree with @luke-jr about keeping (yet unused) warnings in the interface.

@maflcko
Copy link
Member

maflcko commented Oct 25, 2020

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.

@fanquake
Copy link
Member

Concept ACK removing unused code.

@jnewbery
Copy link
Contributor

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.

@maflcko
Copy link
Member

maflcko commented Oct 28, 2020

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.

@jnewbery
Copy link
Contributor

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.

@jnewbery jnewbery changed the title Removed unused warning and formatted RPC result Wallet: Change upgradewallet return type to be an object Oct 28, 2020
@stackman27
Copy link
Contributor Author

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 ?

@jnewbery
Copy link
Contributor

Both commits in this PR is fine

@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch from d218f9e to f922fc8 Compare October 29, 2020 21:05
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR, "Error", "error description during upgrading wallet"}
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch from 32a1aea to f3a9928 Compare October 30, 2020 20:12
Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

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

utACK c93f2ac

throw JSONRPCError(RPC_WALLET_ERROR, error.original);
}
return error.original;
UniValue obj(UniValue::VOBJ);
obj.pushKV("error", error.original);
Copy link
Member

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

@jnewbery
Copy link
Contributor

jnewbery commented Nov 2, 2020

@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.

@fanquake fanquake removed this from the 0.21.0 milestone Nov 2, 2020
@jnewbery jnewbery changed the title Wallet: Change upgradewallet return type to be an object Wallet: do not return warnings from UpgradeWallet() Nov 2, 2020
@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 2, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

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 stackman27 force-pushed the upgradewallet_rpc_cleanup branch 2 times, most recently from 793efcb to bca5420 Compare November 2, 2020 22:32
@stackman27
Copy link
Contributor Author

@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?

@meshcollider
Copy link
Contributor

@stackman27 you may like to include the suggested changes from #20282 (review) in this PR too

@maflcko
Copy link
Member

maflcko commented Nov 4, 2020

review ACK bca5420

@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch 4 times, most recently from a6853cc to e72d8c5 Compare November 13, 2020 19:20
@stackman27
Copy link
Contributor Author

stackman27 commented Nov 13, 2020

@stackman27 you may like to include the suggested changes from #20282 (review) in this PR too

Done! Could you please verify?

Copy link
Member

@jonatack jonatack 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 on just removing the unused warnings. Will re-review after update.

} else {
if(!request.params[0].isNull()) {
obj.pushKV("result", "The wallet was upgraded successfully to version 169900.");
}
Copy link
Member

@jonatack jonatack Nov 16, 2020

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).

Copy link
Contributor Author

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

@stackman27 stackman27 force-pushed the upgradewallet_rpc_cleanup branch from 481f640 to 9636962 Compare November 16, 2020 21:23
@practicalswift
Copy link
Contributor

ACK 9636962: diff looks correct

Thanks for removing unused stuff.

@maflcko
Copy link
Member

maflcko commented Nov 17, 2020

review ACK 9636962

@jonatack
Copy link
Member

ACK 9636962

@maflcko maflcko merged commit c463f70 into bitcoin:master Nov 17, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 17, 2020
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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 23, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.