1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

defs/coins: fix slip44 values

This commit is contained in:
Pavol Rusnak 2018-06-10 22:41:18 +02:00
parent 88e7f7e08d
commit 7be980ae96
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 20 additions and 7 deletions

View File

@ -18,7 +18,7 @@
"xpub_magic_segwit_native": null, "xpub_magic_segwit_native": null,
"bech32_prefix": "bc", "bech32_prefix": "bc",
"cashaddr_prefix": null, "cashaddr_prefix": null,
"slip44": 0, "slip44": 160,
"segwit": true, "segwit": true,
"decred": false, "decred": false,
"fork_id": null, "fork_id": null,

View File

@ -18,7 +18,7 @@
"xpub_magic_segwit_native": null, "xpub_magic_segwit_native": null,
"bech32_prefix": null, "bech32_prefix": null,
"cashaddr_prefix": null, "cashaddr_prefix": null,
"slip44": 5, "slip44": 31,
"segwit": false, "segwit": false,
"decred": false, "decred": false,
"fork_id": null, "fork_id": null,

View File

@ -18,7 +18,7 @@
"xpub_magic_segwit_native": null, "xpub_magic_segwit_native": null,
"bech32_prefix": null, "bech32_prefix": null,
"cashaddr_prefix": null, "cashaddr_prefix": null,
"slip44": 0, "slip44": 83,
"segwit": false, "segwit": false,
"decred": false, "decred": false,
"fork_id": null, "fork_id": null,

View File

@ -3,11 +3,12 @@
# This script generates coins.json files from the definitions in defs/ # This script generates coins.json files from the definitions in defs/
# #
# - `./build_coins.py` generates a big file with everything # - `./build_coins.py` generates a big file with everything
# - `./build_coins.py XXX` generates a file with coins that are supported by XXX # - `./build_coins.py XXX` generates a file with coins supported by XXX
# for example: `./build_coins.py webwallet` or `./build_coins.py trezor1` # for example: `./build_coins.py webwallet` or `./build_coins.py trezor1`
# - `./build_coins.py XXX --defs` also adds protobuf definitions with TOIF icon # - `./build_coins.py XXX --defs` also adds protobuf definitions with TOIF icon
# #
# generated file is coins.json in current directory, and coindefs.json if --def is enabled # generated file is coins.json in current directory,
# and coindefs.json if --def is enabled
import json import json
import glob import glob
@ -201,8 +202,14 @@ if BUILD_DEFS:
# check for colliding address versions # check for colliding address versions
at_p2pkh = {} at_p2pkh = {}
at_p2sh = {} at_p2sh = {}
slip44 = {}
for n, c in coins.items(): for n, c in coins.items():
s = c['slip44']
if s not in slip44:
slip44[s] = []
if not(n.endswith('Testnet') and s == 1):
slip44[s].append(n)
if c['cashaddr_prefix']: # skip cashaddr currencies if c['cashaddr_prefix']: # skip cashaddr currencies
continue continue
a1, a2 = c['address_type'], c['address_type_p2sh'] a1, a2 = c['address_type'], c['address_type_p2sh']
@ -216,11 +223,17 @@ for n, c in coins.items():
print() print()
print('Colliding address_types for P2PKH:') print('Colliding address_types for P2PKH:')
for k, v in at_p2pkh.items(): for k, v in at_p2pkh.items():
if len(v) > 2: if len(v) >= 2:
print('-', k, ':', ','.join(v)) print('-', k, ':', ','.join(v))
print() print()
print('Colliding address_types for P2SH:') print('Colliding address_types for P2SH:')
for k, v in at_p2sh.items(): for k, v in at_p2sh.items():
if len(v) > 2: if len(v) >= 2:
print('-', k, ':', ','.join(v))
print()
print('Colliding SLIP44 constants:')
for k, v in slip44.items():
if len(v) >= 2:
print('-', k, ':', ','.join(v)) print('-', k, ':', ','.join(v))