Skip to content

Commit 72304cc

Browse files
committed
Merge bitcoin/bitcoin#28257: test: check backup from migratewallet can be successfully restored
769f5b1 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 769f5b1 MarcoFalke: lgtm ACK 769f5b1 Tree-SHA512: 94c50b34fbd47c4d3cc34b94e9e7903bc233608c7f50f45c161669996fd5f5b7d8f9a4e6a3437b9151d66a76af833f3f1ca28e44ecb63b5a8f391f6d6be0e39f
2 parents b8ee2fa + 769f5b1 commit 72304cc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/functional/wallet_migration.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,22 @@ def test_basic(self):
134134
self.generate(self.nodes[0], 1)
135135
bal = basic1.getbalance()
136136
txs = basic1.listtransactions()
137+
addr_gps = basic1.listaddressgroupings()
137138

138-
basic1.migratewallet()
139+
basic1_migrate = basic1.migratewallet()
139140
assert_equal(basic1.getwalletinfo()["descriptors"], True)
140141
self.assert_is_sqlite("basic1")
141142
assert_equal(basic1.getbalance(), bal)
142143
self.assert_list_txs_equal(basic1.listtransactions(), txs)
143144

145+
self.log.info("Test backup file can be successfully restored")
146+
self.nodes[0].restorewallet("basic1_restored", basic1_migrate['backup_path'])
147+
basic1_restored = self.nodes[0].get_wallet_rpc("basic1_restored")
148+
basic1_restored_wi = basic1_restored.getwalletinfo()
149+
assert_equal(basic1_restored_wi['balance'], bal)
150+
assert_equal(basic1_restored.listaddressgroupings(), addr_gps)
151+
self.assert_list_txs_equal(basic1_restored.listtransactions(), txs)
152+
144153
# restart node and verify that everything is still there
145154
self.restart_node(0)
146155
default = self.nodes[0].get_wallet_rpc(self.default_wallet_name)

0 commit comments

Comments
 (0)