aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_upgradewallet.py
diff options
context:
space:
mode:
authorSamuel Dobson <dobsonsa68@gmail.com>2021-09-26 12:00:35 +1300
committerSamuel Dobson <dobsonsa68@gmail.com>2021-09-26 15:35:54 +1300
commit6f6f7bb36c492fa76aeda6513be58ca822ea1968 (patch)
treeb56bf520fca3425dd1409e13c8415f91ca618991 /test/functional/wallet_upgradewallet.py
parent2434b1078147e71b09c4c1bf0b7ce3f6729a7713 (diff)
downloadbitcoin-6f6f7bb36c492fa76aeda6513be58ca822ea1968.tar.xz
Make legacy wallet upgrades from non-HD to HD always flush the keypool
Diffstat (limited to 'test/functional/wallet_upgradewallet.py')
-rwxr-xr-xtest/functional/wallet_upgradewallet.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/test/functional/wallet_upgradewallet.py b/test/functional/wallet_upgradewallet.py
index ed98db55c9..917293ea8c 100755
--- a/test/functional/wallet_upgradewallet.py
+++ b/test/functional/wallet_upgradewallet.py
@@ -235,12 +235,7 @@ class UpgradeWalletTest(BitcoinTestFramework):
seed_id = bytearray(seed_id)
seed_id.reverse()
old_kvs = new_kvs
- # First 2 keys should still be non-HD
- for i in range(0, 2):
- info = wallet.getaddressinfo(wallet.getnewaddress())
- assert 'hdkeypath' not in info
- assert 'hdseedid' not in info
- # Next key should be HD
+ # New keys should be HD (the two old keys have been flushed)
info = wallet.getaddressinfo(wallet.getnewaddress())
assert_equal(seed_id.hex(), info['hdseedid'])
assert_equal('m/0\'/0\'/0\'', info['hdkeypath'])
@@ -291,14 +286,7 @@ class UpgradeWalletTest(BitcoinTestFramework):
hd_chain_version, external_counter, seed_id, internal_counter = struct.unpack('<iI20sI', hd_chain)
assert_equal(2, hd_chain_version)
assert_equal(2, internal_counter)
- # Drain the keypool by fetching one external key and one change key. Should still be the same keypool
- info = wallet.getaddressinfo(wallet.getnewaddress())
- assert 'hdseedid' not in info
- assert 'hdkeypath' not in info
- info = wallet.getaddressinfo(wallet.getrawchangeaddress())
- assert 'hdseedid' not in info
- assert 'hdkeypath' not in info
- # The next addresses are HD and should be on different HD chains
+ # The next addresses are HD and should be on different HD chains (the one remaining key in each pool should have been flushed)
info = wallet.getaddressinfo(wallet.getnewaddress())
ext_id = info['hdseedid']
assert_equal('m/0\'/0\'/0\'', info['hdkeypath'])