Skip to content

Commit 725b497

Browse files
committed
Add coverage for restoring backup file from wallet migration
1 parent 90a5786 commit 725b497

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/functional/wallet_backup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,25 @@ def test_pruned_wallet_backup(self):
146146
self.restart_node(3, ["-prune=1", "-fastprune=1"])
147147
# Ensure the chain tip is at height 214, because this test assume it is.
148148
assert_equal(node.getchaintips()[0]["height"], 214)
149+
node.createwallet("legacy-wallet", descriptors=False)
150+
# Ensure the chain tip is at height 214, because this test assume it is.
151+
assert_equal(node.getchaintips()[0]["height"], 214)
149152
# We need a few more blocks so we can actually get above an realistic
150153
# minimal prune height
151154
self.generate(node, 50, sync_fun=self.no_op)
152-
# Backup created at block height 264
153-
node.backupwallet(node.datadir_path / 'wallet_pruned.bak')
155+
# Backups created at block height 264
156+
default_wallet = node.get_wallet_rpc(self.default_wallet_name)
157+
default_wallet.backupwallet(node.datadir_path / 'wallet_pruned.bak')
158+
legacy_wallet = node.get_wallet_rpc("legacy-wallet")
159+
legacy_backup_path = legacy_wallet.migratewallet()["backup_path"]
154160
# Generate more blocks so we can actually prune the older blocks
155161
self.generate(node, 300, sync_fun=self.no_op)
156162
# This gives us an actual prune height roughly in the range of 220 - 240
157163
node.pruneblockchain(250)
158164
# The backup should be updated with the latest height (locator) for
159165
# the backup to load successfully this close to the prune height
160166
node.restorewallet(f'pruned', node.datadir_path / 'wallet_pruned.bak')
167+
node.restorewallet('legacy', legacy_backup_path)
161168

162169
def run_test(self):
163170
self.log.info("Generating initial blockchain")

0 commit comments

Comments
 (0)