Skip to content

Commit

Permalink
Add test for descriptor ranges in wallet_importmulti.py
Browse files Browse the repository at this point in the history
Summary: This wasn't ported from [[bitcoin/bitcoin#14491 | PR14491]] because it used segwit, but this can be done without segwit.

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Subscribers: majcosta, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8359
  • Loading branch information
deadalnix committed Nov 12, 2020
1 parent d718f32 commit 09cc5af
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/functional/wallet_importmulti.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,27 @@ def run_test(self):
addresses = [
"2N7yv4p8G8yEaPddJxY41kPihnWvs39qCMf",
"2MsHxyb2JS3pAySeNUsJ7mNnurtpeenDzLA"]
desc = "sh(pkh(" + xpriv + "/0'/0'/*'" + "))"
desc = "pkh(" + xpriv + "/0'/0'/*'" + ")"
self.log.info(
"Ranged descriptor import should fail without a specified range")
self.test_importmulti({"desc": descsum_create(desc),
"timestamp": "now"},
success=False,
error_code=-8,
error_message='Descriptor is ranged, please specify the range')

# Test importing of a ranged descriptor without keys
self.log.info(
"Should import the ranged descriptor with specified range as solvable")
self.test_importmulti({"desc": descsum_create(desc),
"timestamp": "now",
"range": 1},
success=True,
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."])
for address in addresses:
# P2PKH are not considered solvable.
test_address(self.nodes[1], key.p2pkh_addr, solvable=False)

self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": -1},
success=False, error_code=-8, error_message='End of range is too high')

Expand Down

0 comments on commit 09cc5af

Please sign in to comment.