mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-18 11:21:11 +00:00
tools/cointool: add check for segwit fields
This commit is contained in:
parent
ba562876bd
commit
aa64119b96
@ -14,8 +14,8 @@
|
|||||||
"hash_genesis_block": "00000d23fa0fc52c90893adb1181c9ddffb6c797a3e41864b9a23aa2f2981fe3",
|
"hash_genesis_block": "00000d23fa0fc52c90893adb1181c9ddffb6c797a3e41864b9a23aa2f2981fe3",
|
||||||
"xprv_magic": 76066276,
|
"xprv_magic": 76066276,
|
||||||
"xpub_magic": 76067358,
|
"xpub_magic": 76067358,
|
||||||
"xpub_magic_segwit_p2sh": 77429938,
|
"xpub_magic_segwit_p2sh": null,
|
||||||
"xpub_magic_segwit_native": 78792518,
|
"xpub_magic_segwit_native": null,
|
||||||
"bech32_prefix": null,
|
"bech32_prefix": null,
|
||||||
"cashaddr_prefix": null,
|
"cashaddr_prefix": null,
|
||||||
"slip44": 289,
|
"slip44": 289,
|
||||||
|
@ -411,6 +411,42 @@ def check_key_uniformity(coins):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def check_segwit(coins):
|
||||||
|
for coin in coins:
|
||||||
|
segwit = coin["segwit"]
|
||||||
|
if segwit:
|
||||||
|
if coin["xpub_magic_segwit_native"] is None:
|
||||||
|
print_log(
|
||||||
|
logging.WARNING,
|
||||||
|
coin["name"],
|
||||||
|
"segwit is True => xpub_magic_segwit_native should be set",
|
||||||
|
)
|
||||||
|
# return False
|
||||||
|
if coin["xpub_magic_segwit_p2sh"] is None:
|
||||||
|
print_log(
|
||||||
|
logging.WARNING,
|
||||||
|
coin["name"],
|
||||||
|
"segwit is True => xpub_magic_segwit_p2sh should be set",
|
||||||
|
)
|
||||||
|
# return False
|
||||||
|
else:
|
||||||
|
if coin["xpub_magic_segwit_native"] is not None:
|
||||||
|
print_log(
|
||||||
|
logging.ERROR,
|
||||||
|
coin["name"],
|
||||||
|
"segwit is False => xpub_magic_segwit_native should NOT be set",
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
if coin["xpub_magic_segwit_p2sh"] is not None:
|
||||||
|
print_log(
|
||||||
|
logging.ERROR,
|
||||||
|
coin["name"],
|
||||||
|
"segwit is False => xpub_magic_segwit_p2sh should NOT be set",
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
# ====== coindefs generators ======
|
# ====== coindefs generators ======
|
||||||
|
|
||||||
|
|
||||||
@ -564,6 +600,10 @@ def check(backend, icons, show_duplicates):
|
|||||||
if not check_backends(defs.bitcoin):
|
if not check_backends(defs.bitcoin):
|
||||||
all_checks_passed = False
|
all_checks_passed = False
|
||||||
|
|
||||||
|
print("Checking segwit fields...")
|
||||||
|
if not check_segwit(defs.bitcoin):
|
||||||
|
all_checks_passed = False
|
||||||
|
|
||||||
print("Checking key uniformity...")
|
print("Checking key uniformity...")
|
||||||
for cointype, coinlist in defs.items():
|
for cointype, coinlist in defs.items():
|
||||||
if cointype in ("erc20", "nem"):
|
if cointype in ("erc20", "nem"):
|
||||||
|
Loading…
Reference in New Issue
Block a user