diff options
author | fanquake <fanquake@gmail.com> | 2023-08-16 11:57:47 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-08-16 12:56:09 +0100 |
commit | 72304ccf1e1583fd419222c9d9f0d44938a75352 (patch) | |
tree | 56310407ca3188b82044b1423df19addad2e483e /test | |
parent | b8ee2fa02ef5cb6a559c5f459ce7215ed9f6e15c (diff) | |
parent | 769f5b15f207ce6d1067672ea5e195541c97de6b (diff) |
Merge bitcoin/bitcoin#28257: test: check backup from `migratewallet` can be successfully restored
769f5b15f207ce6d1067672ea5e195541c97de6b test: check backup from `migratewallet` can be successfully restored (brunoerg)
Pull request description:
`migratewallet` migrates the wallet to a descriptor one. During the process, it generates a backup file of the wallet in case of an incorrect migration. This PR adds test to check if the backup file can be successfully restored.
ACKs for top commit:
achow101:
ACK 769f5b15f207ce6d1067672ea5e195541c97de6b
MarcoFalke:
lgtm ACK 769f5b15f207ce6d1067672ea5e195541c97de6b
Tree-SHA512: 94c50b34fbd47c4d3cc34b94e9e7903bc233608c7f50f45c161669996fd5f5b7d8f9a4e6a3437b9151d66a76af833f3f1ca28e44ecb63b5a8f391f6d6be0e39f
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_migration.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/functional/wallet_migration.py b/test/functional/wallet_migration.py index 925376e8cd..c565c879fb 100755 --- a/test/functional/wallet_migration.py +++ b/test/functional/wallet_migration.py @@ -134,13 +134,22 @@ class WalletMigrationTest(BitcoinTestFramework): self.generate(self.nodes[0], 1) bal = basic1.getbalance() txs = basic1.listtransactions() + addr_gps = basic1.listaddressgroupings() - basic1.migratewallet() + basic1_migrate = basic1.migratewallet() assert_equal(basic1.getwalletinfo()["descriptors"], True) self.assert_is_sqlite("basic1") assert_equal(basic1.getbalance(), bal) self.assert_list_txs_equal(basic1.listtransactions(), txs) + self.log.info("Test backup file can be successfully restored") + self.nodes[0].restorewallet("basic1_restored", basic1_migrate['backup_path']) + basic1_restored = self.nodes[0].get_wallet_rpc("basic1_restored") + basic1_restored_wi = basic1_restored.getwalletinfo() + assert_equal(basic1_restored_wi['balance'], bal) + assert_equal(basic1_restored.listaddressgroupings(), addr_gps) + self.assert_list_txs_equal(basic1_restored.listtransactions(), txs) + # restart node and verify that everything is still there self.restart_node(0) default = self.nodes[0].get_wallet_rpc(self.default_wallet_name) |