Add a new RPC command: restorewallet#22541
Conversation
587d0d3 to
b1b6a4f
Compare
ghost
left a comment
There was a problem hiding this comment.
CI is failing because of whitespace at few places https://cirrus-ci.com/task/6700329929539584
You can automatically remove this pre commit by using "files.trimTrailingWhitespace": true in VS Code
b1b6a4f to
7b1b40a
Compare
|
Concept ACK! |
|
Concept ACK. I think this is more of an
I don't think the replacement part is necessary (or desirable). As I understand, you can place it in the Needs a RPC test. |
This gives error: |
|
@prayank23 the error says that you are trying to load a copy of already existing wallet. Try the same with the wallet created on another node |
Right. Wallet will be different when users restore from backup. Because if there is already a wallet, there is no need to restore. Or it can be same in few cases? |
22f6d7b to
2f70a30
Compare
98c291c to
bc241c7
Compare
|
|
bc241c7 to
8f87ef4
Compare
|
ACK 8f87ef44013caf78e1405ca89f8097cbde1a11b0 |
… instead of restoring wallets manually.
8f87ef4 to
5fe8100
Compare
|
re-ACK 5fe8100 |
|
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. |
|
tACK 5fe8100 Tested on windows with below commands:
|
|
Great first contribution, thank you! 🎉 |
5fe8100 Change the wallet_backup.py test to use the restorewallet RPC command instead of restoring wallets manually. (lsilva01) ae23fab Add a new RPC command: restorewallet (lsilva01) Pull request description: As far as I know, there is no command to restore the wallet from a backup file. The only way to do this is to replace the `wallet.dat` of a newly created wallet with the backup file, which is hardly an intuitive way. This PR implements the `restorewallet` RPC command which restores the wallet from the backup file. To test: First create a backup file: `$ bitcoin-cli -rpcwallet="wallet-01" backupwallet /home/Backups/wallet-01.bak` Then restore it in another wallet: `$ bitcoin-cli restorewallet "restored-wallet-01" /home/Backups/wallet-01.bak` ACKs for top commit: achow101: re-ACK 5fe8100 prayank23: tACK bitcoin@5fe8100 meshcollider: utACK 5fe8100 Tree-SHA512: 9639df4d8ad32f255f5b868320dc69878bd9aceb3b471b49dfad500b67681e2d354292b5410982fbf18e25a44ed0c06fd4a0dd010e82807c2e00ff32e84047a1
As far as I know, there is no command to restore the wallet from a backup file.
The only way to do this is to replace the
wallet.datof a newly created wallet with the backup file, which is hardly an intuitive way.This PR implements the
restorewalletRPC command which restores the wallet from the backup file.To test:
First create a backup file:
$ bitcoin-cli -rpcwallet="wallet-01" backupwallet /home/Backups/wallet-01.bakThen restore it in another wallet:
$ bitcoin-cli restorewallet "restored-wallet-01" /home/Backups/wallet-01.bak