mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 14:12:49 +02:00
wallet, migration: Fix crash on empty wallet
Same as with a blank wallet, wallets with no legacy records (i.e. empty, non-blank, watch-only wallet) do not require to be migrated.
This commit is contained in:
@@ -445,6 +445,15 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||
# After migrating, the "keypool" is empty
|
||||
assert_raises_rpc_error(-4, "Error: This wallet has no available keys", watchonly1.getnewaddress)
|
||||
|
||||
self.log.info("Test migration of a watch-only empty wallet")
|
||||
for idx, is_blank in enumerate([True, False], start=1):
|
||||
wallet_name = f"watchonly_empty{idx}"
|
||||
self.create_legacy_wallet(wallet_name, disable_private_keys=True, blank=is_blank)
|
||||
_, watchonly_empty = self.migrate_and_get_rpc(wallet_name)
|
||||
info = watchonly_empty.getwalletinfo()
|
||||
assert_equal(info["private_keys_enabled"], False)
|
||||
assert_equal(info["blank"], is_blank)
|
||||
|
||||
def test_pk_coinbases(self):
|
||||
self.log.info("Test migration of a wallet using old pk() coinbases")
|
||||
wallet = self.create_legacy_wallet("pkcb")
|
||||
|
Reference in New Issue
Block a user