mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-19 19:29:45 +02:00
Merge bitcoin/bitcoin#32149: wallet, migration: Fix empty wallet crash
0f602c5693wallet, migration: Fix crash on empty wallet (pablomartin4btc)42c13141b5wallet, refactor: Decouple into HasLegacyRecords() (pablomartin4btc) Pull request description: Same as with a blank wallet (#28976), wallets with no legacy records (i.e. empty, non-blank, watch-only wallet) do not require to be migrated. Steps to reproduce the issue: 1.- `createwallet "empty_wo_noblank_legacy_wallet" true false "" false false` 2.- `migratewallet` ``` wallet/wallet.cpp:4071 GetDescriptorsForLegacy: Assertion `legacy_spkm' failed. Aborted (core dumped) ``` ACKs for top commit: davidgumberg: untested reACK0f602c5693fjahr: re-ACK0f602c5693achow101: ACK0f602c5693furszy: ACK0f602c5693BrandonOdiwuor: Code Review ACK0f602c5693Tree-SHA512: 796c3f0b1946281097f7ffc3563bc79f879e80a98237012535cc530a4a2239fd2d71a17b4f54e30258886dc9f0b83206d7a5d50312e4fc6d0abe4f559fbe07ec
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