From d47dc356af20fa2fc4dfdeb04dd6b5e4b6d7a516 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 2 Nov 2019 23:07:23 +0000 Subject: [PATCH] altcoin trust level initialization fix --- mmgen/protocol.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mmgen/protocol.py b/mmgen/protocol.py index cb3a05fc..aecfc801 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -488,9 +488,13 @@ def init_genonly_altcoins(usr_coin,trust_level=None): if usr_coin.lower() in CoinProtocol.coins: return CoinProtocol.coins[usr_coin.lower()][2] usr_coin = usr_coin.upper() - mn_coins = [e.symbol for e in ci.coin_constants['mainnet'] if e.trust_level != -1] - if usr_coin not in mn_coins: return None - trust_level = ci.coin_constants['mainnet'][mn_coins.index(usr_coin)].trust_level + usr_entry = [e for e in ci.coin_constants['mainnet'] if e.symbol == usr_coin] + if not usr_entry: + raise ValueError('Coin {} not recognized'.format(usr_coin)) + usr_entry = usr_entry[0] + if usr_entry.trust_level == -1: + raise ValueError('Coin {} ({}) not supported'.format(usr_coin,usr_entry.name)) + trust_level = usr_entry.trust_level data = {} for k in ('mainnet','testnet'): data[k] = [e for e in ci.coin_constants[k] if e.trust_level >= trust_level]