Skip to content

RPC: Better safety with newkeypool command and wallet backups - #23341

Merged
achow101 merged 1 commit into
bitcoin:masterfrom
meshcollider:202110_newkeypool_documentation
Dec 20, 2021
Merged

achow101 merged 1 commit into
bitcoin:masterfrom
meshcollider:202110_newkeypool_documentation

Conversation

@meshcollider

@meshcollider meshcollider commented Oct 23, 2021

Copy link
Copy Markdown
Contributor

This PR prevents newkeypool from being run on non-HD wallets, because this would require a new backup every time, so it isn't very safe.

David Harding also suggested here that the RPC help text should include a warning to the users about the interaction between newkeypool.

@lsilva01 lsilva01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review ACK 04153bc

@stratospher stratospher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested ACK 04153bc on a non HD wallet. The warning is really helpful.

$ src/bitcoin-cli --testnet -rpcwallet=mynonHD newkeypool
error code: -4
error message:
Error: Cannot use newkeypool on non-HD wallets.

@luke-jr luke-jr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept NACK. Users of non-HD wallets expect to make new backups regularly. No reason to deny them this RPC method...

@meshcollider

meshcollider commented Oct 29, 2021

Copy link
Copy Markdown
Contributor Author

@luke-jr can you provide a reason for its usefulness? It was only just added, so I can't imagine anyone relying on it...

@luke-jr

luke-jr commented Oct 29, 2021

Copy link
Copy Markdown
Contributor

Maybe I'm missing the point of it entirely? I'm just saying artificially blocking non-HD wallets from using it seems unreasonable. I can't think of a use case for this with a HD wallet (won't the new keypool just end up with the same keys?), but it seems useful for non-HD wallets to intentionally avoid new funds from being accessible with old (compromised?) backups.

@meshcollider

meshcollider commented Oct 30, 2021

Copy link
Copy Markdown
Contributor Author

HD wallets will be restocked with entirely new keys. That's an interesting use-case, I mainly had in mind people who have upgraded non-HD to HD and want to clear out all their non-HD keys in one go. But I can just add some large warnings in the non-HD case.

In that case though @luke-jr why not just make a new wallet?

@DrahtBot

DrahtBot commented Dec 2, 2021

Copy link
Copy Markdown
Contributor

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

Conflicts

No conflicts as of last run.

@DrahtBot DrahtBot mentioned this pull request Dec 4, 2021
@meshcollider

Copy link
Copy Markdown
Contributor Author

Rebased.

@achow101

Copy link
Copy Markdown
Member

I agree with @luke-jr. This RPC is useful for non-HD wallets too. It just need to come with large warnings about backups.

@meshcollider

Copy link
Copy Markdown
Contributor Author

Done 👍

@meshcollider meshcollider added this to the 23.0 milestone Dec 20, 2021
@achow101

Copy link
Copy Markdown
Member

ACK a2a9231

@achow101
achow101 merged commit 887796a into bitcoin:master Dec 20, 2021
@meshcollider
meshcollider deleted the 202110_newkeypool_documentation branch December 20, 2021 20:53
@bitcoin bitcoin locked and limited conversation to collaborators Dec 20, 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.

6 participants