coin_info: when support status is unknown, only presume "soon" for tokens

pull/41/head
matejcik 6 years ago
parent 441b67ed7c
commit bc5530e503

@ -304,15 +304,18 @@ def support_info_single(support_data, coin):
dup = coin.get("duplicate")
for device, values in support_data.items():
if dup and is_token(coin):
support_value = None
support_value = False
elif key in values["unsupported"]:
support_value = None
support_value = False
elif key in values["supported"]:
support_value = values["supported"][key]
elif device in MISSING_SUPPORT_MEANS_NO:
support_value = None
else:
support_value = False
elif is_token(coin):
# tokens are implicitly supported in next release
support_value = "soon"
else:
support_value = None
support_info[device] = support_value
return support_info

@ -194,7 +194,7 @@ def check_btc(coins):
coin_strings.append(prefix + hl)
return ", ".join(coin_strings)
def print_collision_buckets(buckets, prefix):
def print_collision_buckets(buckets, prefix, maxlevel=logging.ERROR):
"""Intelligently print collision buckets.
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:
if coin["name"] == "Bitcoin":
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
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 have_bitcoin and len(supported_networks) > 1:
# ANY collision with Bitcoin is bad
level = logging.ERROR
level = maxlevel
failed = True
elif len(supported_mainnets) > 1:
# collision between supported networks is still pretty bad
@ -239,7 +239,7 @@ def check_btc(coins):
# only check address_type on coins that don't use cashaddr
nocashaddr = [coin for coin in coins if not coin.get("cashaddr_prefix")]
print("Checking address_type collisions...")
address_type = find_address_collisions(nocashaddr, "address_type")
if print_collision_buckets(address_type, "address type"):
@ -248,7 +248,7 @@ def check_btc(coins):
print("Checking address_type_p2sh collisions...")
address_type_p2sh = find_address_collisions(nocashaddr, "address_type_p2sh")
# 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
@ -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 more than one non-token, it's ERROR and printed always.
"""
def coin_str(coin):
"""Colorize coins. Tokens are cyan, nontokens are red. Coins that are NOT
marked duplicate get a green asterisk.

Loading…
Cancel
Save