1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00
trezor-firmware/coins-check.py

46 lines
1.8 KiB
Python
Raw Normal View History

2017-11-14 01:18:28 +00:00
#!/usr/bin/env python3
import json
def is_hex(val):
try:
int(val, 16)
return True
except:
return False
for coin in json.load(open('coins.json')):
assert isinstance(coin['coin_name'], str)
assert isinstance(coin['coin_shortcut'], str)
assert isinstance(coin['coin_label'], str)
2017-12-18 16:21:50 +00:00
assert isinstance(coin['curve_name'], str)
2017-11-14 01:18:28 +00:00
assert isinstance(coin['address_type'], int)
assert isinstance(coin['address_type_p2sh'], int)
assert coin['address_type'] != coin['address_type_p2sh']
assert isinstance(coin['maxfee_kb'], int)
assert isinstance(coin['minfee_kb'], int)
assert coin['maxfee_kb'] > coin['minfee_kb']
assert coin['signed_message_header']
assert is_hex(coin['hash_genesis_block'])
assert is_hex(coin['xprv_magic'])
assert is_hex(coin['xpub_magic'])
assert isinstance(coin['bip44'], int)
assert isinstance(coin['segwit'], bool)
2017-12-18 16:21:50 +00:00
assert isinstance(coin['decred'], bool)
2017-11-14 01:18:28 +00:00
assert coin['forkid'] is None or isinstance(coin['forkid'], int)
assert isinstance(coin['force_bip143'], bool)
assert coin['version_group_id'] is None or is_hex(coin['version_group_id'])
2017-11-14 01:18:28 +00:00
assert isinstance(coin['default_fee_b'], dict)
assert isinstance(coin['dust_limit'], int)
assert isinstance(coin['blocktime_minutes'], int) or isinstance(coin['blocktime_minutes'], float)
assert coin['firmware'] is None or coin['firmware'] in ['stable', 'debug']
assert isinstance(coin['signed_message_header'], str)
assert isinstance(coin['min_address_length'], int)
assert isinstance(coin['max_address_length'], int)
assert isinstance(coin['bitcore'], list)
assert coin['xpub_magic_segwit_p2sh'] is None or is_hex(coin['xpub_magic_segwit_p2sh'])
assert coin['bech32_prefix'] is None or isinstance(coin['bech32_prefix'], str)
print('OK')