Changeset View
Changeset View
Standalone View
Standalone View
contrib/linearize/linearize-hashes.py
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | while height < settings['max_height'] + 1: | ||||
if reply is None: | if reply is None: | ||||
print('Cannot continue. Program will halt.') | print('Cannot continue. Program will halt.') | ||||
return None | return None | ||||
for x, resp_obj in enumerate(reply): | for x, resp_obj in enumerate(reply): | ||||
if rpc.response_is_error(resp_obj): | if rpc.response_is_error(resp_obj): | ||||
print('JSON-RPC: error at height', height + x, | print('JSON-RPC: error at height', height + x, | ||||
': ', resp_obj['error'], file=sys.stderr) | ': ', resp_obj['error'], file=sys.stderr) | ||||
exit(1) | sys.exit(1) | ||||
assert(resp_obj['id'] == x) # assume replies are in-sequence | assert(resp_obj['id'] == x) # assume replies are in-sequence | ||||
if settings['rev_hash_bytes'] == 'true': | if settings['rev_hash_bytes'] == 'true': | ||||
resp_obj['result'] = hex_switchEndian(resp_obj['result']) | resp_obj['result'] = hex_switchEndian(resp_obj['result']) | ||||
print(resp_obj['result']) | print(resp_obj['result']) | ||||
height += num_blocks | height += num_blocks | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |