Skip to content

Commit

Permalink
tests: Test migration of blank wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Nov 30, 2023
1 parent 6e3fd97 commit be65848
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/functional/wallet_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ def assert_is_sqlite(self, wallet_name):
assert_equal(file_magic, b'SQLite format 3\x00')
assert_equal(self.nodes[0].get_wallet_rpc(wallet_name).getwalletinfo()["format"], "sqlite")

def create_legacy_wallet(self, wallet_name, disable_private_keys=False):
self.nodes[0].createwallet(wallet_name=wallet_name, descriptors=False, disable_private_keys=disable_private_keys)
def create_legacy_wallet(self, wallet_name, **kwargs):
self.nodes[0].createwallet(wallet_name=wallet_name, descriptors=False, **kwargs)
wallet = self.nodes[0].get_wallet_rpc(wallet_name)
info = wallet.getwalletinfo()
assert_equal(info["descriptors"], False)
assert_equal(info["format"], "bdb")
assert_equal(info["private_keys_enabled"], not disable_private_keys)
return wallet

def assert_addr_info_equal(self, addr_info, addr_info_old):
Expand Down Expand Up @@ -876,6 +875,13 @@ def test_failed_migration_cleanup(self):
_, _, magic = struct.unpack("QII", data)
assert_equal(magic, BTREE_MAGIC)

def test_blank(self):
self.log.info("Test that a blank wallet is migrated")
wallet = self.create_legacy_wallet("blank", blank=True)
assert_equal(wallet.getwalletinfo()["blank"], True)
wallet.migratewallet()
assert_equal(wallet.getwalletinfo()["blank"], True)


def run_test(self):
self.generate(self.nodes[0], 101)
Expand All @@ -896,6 +902,7 @@ def run_test(self):
self.test_conflict_txs()
self.test_hybrid_pubkey()
self.test_failed_migration_cleanup()
self.test_blank()

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

0 comments on commit be65848

Please sign in to comment.