Skip to content

Commit 88afc73

Browse files
committed
tests: Test for migrating encrypted wallets
Due to an oversight, we cannot currently migrate encrypted wallets, regardless of whether they are unlocked. Migrating such wallets will trigger an error, and result in the cleanup being run. This conveniently allows us to check some parts of the cleanup code.
1 parent 86ef7b3 commit 88afc73

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/functional/wallet_migration.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,16 @@ def test_pk_coinbases(self):
393393

394394
assert_equal(bals, wallet.getbalances())
395395

396+
def test_encrypted(self):
397+
self.log.info("Test migration of an encrypted wallet")
398+
wallet = self.create_legacy_wallet("encrypted")
399+
400+
wallet.encryptwallet("pass")
401+
402+
wallet.walletpassphrase("pass", 10)
403+
assert_raises_rpc_error(-4, "Error: Unable to produce descriptors for this legacy wallet. Make sure the wallet is unlocked first", wallet.migratewallet)
404+
# TODO: Fix migratewallet so that we can actually migrate encrypted wallets
405+
396406
def run_test(self):
397407
self.generate(self.nodes[0], 101)
398408

@@ -402,6 +412,7 @@ def run_test(self):
402412
self.test_other_watchonly()
403413
self.test_no_privkeys()
404414
self.test_pk_coinbases()
415+
self.test_encrypted()
405416

406417
if __name__ == '__main__':
407418
WalletMigrationTest().main()

0 commit comments

Comments
 (0)