Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_importmulti.py
Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
"Should fail to import a p2pkh address from descriptor with no checksum") | "Should fail to import a p2pkh address from descriptor with no checksum") | ||||
self.test_importmulti({"desc": "pkh(" + key.pubkey + ")", | self.test_importmulti({"desc": "pkh(" + key.pubkey + ")", | ||||
"timestamp": "now", | "timestamp": "now", | ||||
"label": "Descriptor import test"}, | "label": "Descriptor import test"}, | ||||
success=False, | success=False, | ||||
error_code=-5, | error_code=-5, | ||||
error_message='Descriptor is invalid') | error_message='Descriptor is invalid') | ||||
xpriv = "tprv8ZgxMBicQKsPeuVhWwi6wuMQGfPKi9Li5GtX35jVNknACgqe3CY4g5xgkfDDJcmtF7o1QnxWDRYw4H5P26PXq7sbcUkEqeR4fg3Kxp2tigg" | |||||
# hdkeypath=m/0'/0'/0' and 1' | |||||
addresses = [ | |||||
"2N7yv4p8G8yEaPddJxY41kPihnWvs39qCMf", | |||||
"2MsHxyb2JS3pAySeNUsJ7mNnurtpeenDzLA"] | |||||
desc = "sh(pkh(" + xpriv + "/0'/0'/*'" + "))" | |||||
self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": -1}, | |||||
success=False, error_code=-8, error_message='End of range is too high') | |||||
self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": [-1, 10]}, | |||||
success=False, error_code=-8, error_message='Range should be greater or equal than 0') | |||||
self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": [(2 << 31 + 1) - 1000000, (2 << 31 + 1)]}, | |||||
success=False, error_code=-8, error_message='End of range is too high') | |||||
self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": [2, 1]}, | |||||
success=False, error_code=-8, error_message='Range specified as [begin,end] must not have begin after end') | |||||
self.test_importmulti({"desc": descsum_create(desc), "timestamp": "now", "range": [0, 1000001]}, | |||||
success=False, error_code=-8, error_message='Range is too large') | |||||
# Test importing of a P2PKH address via descriptor | # Test importing of a P2PKH address via descriptor | ||||
key = get_key(self.nodes[0]) | key = get_key(self.nodes[0]) | ||||
self.log.info("Should import a p2pkh address from descriptor") | self.log.info("Should import a p2pkh address from descriptor") | ||||
self.test_importmulti({"desc": descsum_create("pkh(" + key.pubkey + ")"), | self.test_importmulti({"desc": descsum_create("pkh(" + key.pubkey + ")"), | ||||
"timestamp": "now", | "timestamp": "now", | ||||
"label": "Descriptor import test"}, | "label": "Descriptor import test"}, | ||||
success=True, | success=True, | ||||
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."]) | warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."]) | ||||
▲ Show 20 Lines • Show All 231 Lines • Show Last 20 Lines |