Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_importmulti.py
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
"Should import a scriptPubKey with internal and with public key") | "Should import a scriptPubKey with internal and with public key") | ||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | ||||
request = [{ | request = [{ | ||||
"scriptPubKey": address['scriptPubKey'], | "scriptPubKey": address['scriptPubKey'], | ||||
"timestamp": "now", | "timestamp": "now", | ||||
"pubkeys": [address['pubkey']], | "pubkeys": [address['pubkey']], | ||||
"internal": True | "internal": True | ||||
}] | }] | ||||
result = self.nodes[1].importmulti(request) | result = self.nodes[1].importmulti(requests=request) | ||||
assert_equal(result[0]['success'], True) | assert_equal(result[0]['success'], True) | ||||
address_assert = self.nodes[1].getaddressinfo(address['address']) | address_assert = self.nodes[1].getaddressinfo(address['address']) | ||||
assert_equal(address_assert['iswatchonly'], True) | assert_equal(address_assert['iswatchonly'], True) | ||||
assert_equal(address_assert['ismine'], False) | assert_equal(address_assert['ismine'], False) | ||||
assert_equal(address_assert['timestamp'], timestamp) | assert_equal(address_assert['timestamp'], timestamp) | ||||
# ScriptPubKey + Public key + !internal | # ScriptPubKey + Public key + !internal | ||||
self.log.info( | self.log.info( | ||||
"Should not import a scriptPubKey without internal and with public key") | "Should not import a scriptPubKey without internal and with public key") | ||||
address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | address = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress()) | ||||
request = [{ | request = [{ | ||||
"scriptPubKey": address['scriptPubKey'], | "scriptPubKey": address['scriptPubKey'], | ||||
"timestamp": "now", | "timestamp": "now", | ||||
"pubkeys": [address['pubkey']] | "pubkeys": [address['pubkey']] | ||||
}] | }] | ||||
result = self.nodes[1].importmulti(request) | result = self.nodes[1].importmulti(requests=request) | ||||
assert_equal(result[0]['success'], False) | assert_equal(result[0]['success'], False) | ||||
assert_equal(result[0]['error']['code'], -8) | assert_equal(result[0]['error']['code'], -8) | ||||
assert_equal(result[0]['error']['message'], | assert_equal(result[0]['error']['message'], | ||||
'Internal must be set for hex scriptPubKey') | 'Internal must be set for hex scriptPubKey') | ||||
address_assert = self.nodes[1].getaddressinfo(address['address']) | address_assert = self.nodes[1].getaddressinfo(address['address']) | ||||
assert_equal(address_assert['iswatchonly'], False) | assert_equal(address_assert['iswatchonly'], False) | ||||
assert_equal(address_assert['ismine'], False) | assert_equal(address_assert['ismine'], False) | ||||
assert_equal('timestamp' in address_assert, False) | assert_equal('timestamp' in address_assert, False) | ||||
▲ Show 20 Lines • Show All 336 Lines • Show Last 20 Lines |