Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_importmulti.py
Show First 20 Lines • Show All 443 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(result[0]['success'], False) | assert_equal(result[0]['success'], False) | ||||
assert_equal(result[0]['error']['code'], -5) | assert_equal(result[0]['error']['code'], -5) | ||||
assert_equal(result[0]['error']['message'], 'Consistency check failed') | assert_equal(result[0]['error']['message'], 'Consistency check failed') | ||||
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) | ||||
# Importing existing watch only address with new timestamp should replace saved timestamp. | # Importing existing watch only address with new timestamp should | ||||
# replace saved timestamp. | |||||
assert_greater_than(timestamp, watchonly_timestamp) | assert_greater_than(timestamp, watchonly_timestamp) | ||||
self.log.info("Should replace previously saved watch only timestamp.") | self.log.info("Should replace previously saved watch only timestamp.") | ||||
result = self.nodes[1].importmulti([{ | result = self.nodes[1].importmulti([{ | ||||
"scriptPubKey": { | "scriptPubKey": { | ||||
"address": watchonly_address, | "address": watchonly_address, | ||||
}, | }, | ||||
"timestamp": "now", | "timestamp": "now", | ||||
}]) | }]) | ||||
assert_equal(result[0]['success'], True) | assert_equal(result[0]['success'], True) | ||||
address_assert = self.nodes[1].getaddressinfo(watchonly_address) | address_assert = self.nodes[1].getaddressinfo(watchonly_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) | ||||
watchonly_timestamp = timestamp | watchonly_timestamp = timestamp | ||||
# restart nodes to check for proper serialization/deserialization of watch only address | # restart nodes to check for proper serialization/deserialization of | ||||
# watch only address | |||||
self.stop_nodes() | self.stop_nodes() | ||||
self.start_nodes() | self.start_nodes() | ||||
address_assert = self.nodes[1].getaddressinfo(watchonly_address) | address_assert = self.nodes[1].getaddressinfo(watchonly_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'], watchonly_timestamp) | assert_equal(address_assert['timestamp'], watchonly_timestamp) | ||||
# Bad or missing timestamps | # Bad or missing timestamps | ||||
Show All 14 Lines |