mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-05 13:01:12 +00:00
coin_info: when support status is unknown, only presume "soon" for tokens
This commit is contained in:
parent
441b67ed7c
commit
bc5530e503
@ -304,15 +304,18 @@ def support_info_single(support_data, coin):
|
|||||||
dup = coin.get("duplicate")
|
dup = coin.get("duplicate")
|
||||||
for device, values in support_data.items():
|
for device, values in support_data.items():
|
||||||
if dup and is_token(coin):
|
if dup and is_token(coin):
|
||||||
support_value = None
|
support_value = False
|
||||||
elif key in values["unsupported"]:
|
elif key in values["unsupported"]:
|
||||||
support_value = None
|
support_value = False
|
||||||
elif key in values["supported"]:
|
elif key in values["supported"]:
|
||||||
support_value = values["supported"][key]
|
support_value = values["supported"][key]
|
||||||
elif device in MISSING_SUPPORT_MEANS_NO:
|
elif device in MISSING_SUPPORT_MEANS_NO:
|
||||||
support_value = None
|
support_value = False
|
||||||
else:
|
elif is_token(coin):
|
||||||
|
# tokens are implicitly supported in next release
|
||||||
support_value = "soon"
|
support_value = "soon"
|
||||||
|
else:
|
||||||
|
support_value = None
|
||||||
support_info[device] = support_value
|
support_info[device] = support_value
|
||||||
return support_info
|
return support_info
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ def check_btc(coins):
|
|||||||
coin_strings.append(prefix + hl)
|
coin_strings.append(prefix + hl)
|
||||||
return ", ".join(coin_strings)
|
return ", ".join(coin_strings)
|
||||||
|
|
||||||
def print_collision_buckets(buckets, prefix):
|
def print_collision_buckets(buckets, prefix, maxlevel=logging.ERROR):
|
||||||
"""Intelligently print collision buckets.
|
"""Intelligently print collision buckets.
|
||||||
|
|
||||||
For each bucket, if there are any collision with a mainnet, print it.
|
For each bucket, if there are any collision with a mainnet, print it.
|
||||||
@ -210,7 +210,7 @@ def check_btc(coins):
|
|||||||
for coin in mainnets:
|
for coin in mainnets:
|
||||||
if coin["name"] == "Bitcoin":
|
if coin["name"] == "Bitcoin":
|
||||||
have_bitcoin = True
|
have_bitcoin = True
|
||||||
if all(v is None for k,v in support_infos[coin["key"]].items()):
|
if all(v is False for k, v in support_infos[coin["key"]].items()):
|
||||||
coin["unsupported"] = True
|
coin["unsupported"] = True
|
||||||
|
|
||||||
supported_mainnets = [c for c in mainnets if not c.get("unsupported")]
|
supported_mainnets = [c for c in mainnets if not c.get("unsupported")]
|
||||||
@ -219,7 +219,7 @@ def check_btc(coins):
|
|||||||
if len(mainnets) > 1:
|
if len(mainnets) > 1:
|
||||||
if have_bitcoin and len(supported_networks) > 1:
|
if have_bitcoin and len(supported_networks) > 1:
|
||||||
# ANY collision with Bitcoin is bad
|
# ANY collision with Bitcoin is bad
|
||||||
level = logging.ERROR
|
level = maxlevel
|
||||||
failed = True
|
failed = True
|
||||||
elif len(supported_mainnets) > 1:
|
elif len(supported_mainnets) > 1:
|
||||||
# collision between supported networks is still pretty bad
|
# collision between supported networks is still pretty bad
|
||||||
@ -248,7 +248,7 @@ def check_btc(coins):
|
|||||||
print("Checking address_type_p2sh collisions...")
|
print("Checking address_type_p2sh collisions...")
|
||||||
address_type_p2sh = find_address_collisions(nocashaddr, "address_type_p2sh")
|
address_type_p2sh = find_address_collisions(nocashaddr, "address_type_p2sh")
|
||||||
# we ignore failed checks on P2SH, because reasons
|
# we ignore failed checks on P2SH, because reasons
|
||||||
print_collision_buckets(address_type_p2sh, "address type")
|
print_collision_buckets(address_type_p2sh, "address type", logging.WARNING)
|
||||||
|
|
||||||
return check_passed
|
return check_passed
|
||||||
|
|
||||||
@ -263,6 +263,7 @@ def check_dups(buckets, print_at_level=logging.ERROR):
|
|||||||
If the collision includes one non-token, it's INFO.
|
If the collision includes one non-token, it's INFO.
|
||||||
If the collision includes more than one non-token, it's ERROR and printed always.
|
If the collision includes more than one non-token, it's ERROR and printed always.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def coin_str(coin):
|
def coin_str(coin):
|
||||||
"""Colorize coins. Tokens are cyan, nontokens are red. Coins that are NOT
|
"""Colorize coins. Tokens are cyan, nontokens are red. Coins that are NOT
|
||||||
marked duplicate get a green asterisk.
|
marked duplicate get a green asterisk.
|
||||||
|
Loading…
Reference in New Issue
Block a user