diff options
author | Andrew Chow <achow101-github@achow101.com> | 2018-12-16 14:08:55 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-02-14 18:34:03 -0500 |
commit | f4b00b70e811d3772589ab3c64d7658f4dbdab69 (patch) | |
tree | 81a3f474331aff4d7bbf1c65567582e92f3fc069 /test | |
parent | 9e1551b9ceda0056fcbc78bf5827bff1bfc5d51b (diff) |
Import public keys in order
Do public key imports in the order that they are specified in the import
or in the descriptor range.
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_importmulti.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py index 3f77c5e5fd..46e3ab77c8 100755 --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -777,5 +777,30 @@ class ImportMultiTest(BitcoinTestFramework): assert_equal(result[0]['error']['code'], -8) assert_equal(result[0]['error']['message'], "Keys can only be imported to the keypool when private keys are disabled") + # Make sure ranged imports import keys in order + self.log.info('Key ranges should be imported in order') + wrpc = self.nodes[1].get_wallet_rpc("noprivkeys") + assert_equal(wrpc.getwalletinfo()["keypoolsize"], 0) + assert_equal(wrpc.getwalletinfo()["private_keys_enabled"], False) + xpub = "tpubDAXcJ7s7ZwicqjprRaEWdPoHKrCS215qxGYxpusRLLmJuT69ZSicuGdSfyvyKpvUNYBW1s2U3NSrT6vrCYB9e6nZUEvrqnwXPF8ArTCRXMY" + addresses = [ + 'bcrt1qtmp74ayg7p24uslctssvjm06q5phz4yrxucgnv', # m/0'/0'/0 + 'bcrt1q8vprchan07gzagd5e6v9wd7azyucksq2xc76k8', # m/0'/0'/1 + 'bcrt1qtuqdtha7zmqgcrr26n2rqxztv5y8rafjp9lulu', # m/0'/0'/2 + 'bcrt1qau64272ymawq26t90md6an0ps99qkrse58m640', # m/0'/0'/3 + 'bcrt1qsg97266hrh6cpmutqen8s4s962aryy77jp0fg0', # m/0'/0'/4 + ] + result = wrpc.importmulti( + [{ + 'desc': 'wpkh([80002067/0h/0h]' + xpub + '/*)', + 'keypool': True, + 'timestamp': 'now', + 'range' : {'start': 0, 'end': 4} + }] + ) + for i in range(0, 5): + addr = wrpc.getnewaddress('', 'bech32') + assert_equal(addr, addresses[i]) + if __name__ == '__main__': ImportMultiTest().main() |