Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_dumptxoutset.py
Show All 29 Lines | def run_test(self): | ||||
assert expected_path.is_file() | assert expected_path.is_file() | ||||
assert_equal(out['coins_written'], 100) | assert_equal(out['coins_written'], 100) | ||||
assert_equal(out['base_height'], 100) | assert_equal(out['base_height'], 100) | ||||
assert_equal(out['path'], str(expected_path)) | assert_equal(out['path'], str(expected_path)) | ||||
# Blockhash should be deterministic based on mocked time. | # Blockhash should be deterministic based on mocked time. | ||||
assert_equal( | assert_equal( | ||||
out['base_hash'], | out['base_hash'], | ||||
'65d0aec2439aae14373c153f596fb90a87b643d9bff3e65f250aa8f055e6816b') | '0ad635f9fdebb88f4c1d8d3e3348b9e0bc065a09f7c0f4a22aa82efcff52c282') | ||||
with open(str(expected_path), 'rb') as f: | with open(str(expected_path), 'rb') as f: | ||||
digest = hashlib.sha256(f.read()).hexdigest() | digest = hashlib.sha256(f.read()).hexdigest() | ||||
# UTXO snapshot hash should be deterministic based on mocked time. | # UTXO snapshot hash should be deterministic based on mocked time. | ||||
assert_equal( | assert_equal( | ||||
digest, | digest, | ||||
'05957e146e38153d84e9294999cc24f0dcdb9902c4834b32c79ae8e8985babea') | '95eb6944beb0fe3e93e63e50836ee2c9e2d4e755c4eba16314232af005c319a3') | ||||
# Specifying a path to an existing file will fail. | # Specifying a path to an existing file will fail. | ||||
assert_raises_rpc_error( | assert_raises_rpc_error( | ||||
-8, '{} already exists'.format(FILENAME), node.dumptxoutset, FILENAME) | -8, '{} already exists'.format(FILENAME), node.dumptxoutset, FILENAME) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
DumptxoutsetTest().main() | DumptxoutsetTest().main() |