Disable Navcoin.

This commit is contained in:
tecnovert 2023-10-09 16:43:09 +02:00
parent 22e005728a
commit 23330c20bc
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
3 changed files with 38 additions and 14 deletions

View File

@ -1,3 +1,3 @@
name = "basicswap" name = "basicswap"
__version__ = "0.11.67" __version__ = "0.11.68"

View File

@ -67,6 +67,7 @@ NAV_VERSION_TAG = os.getenv('NAV_VERSION', '')
GUIX_SSL_CERT_DIR = None GUIX_SSL_CERT_DIR = None
ADD_PUBKEY_URL = os.getenv('ADD_PUBKEY_URL', '') ADD_PUBKEY_URL = os.getenv('ADD_PUBKEY_URL', '')
OVERRIDE_DISABLED_COINS = toBool(os.getenv('OVERRIDE_DISABLED_COINS', 'false'))
known_coins = { known_coins = {
@ -82,6 +83,10 @@ known_coins = {
'navcoin': (NAV_VERSION, NAV_VERSION_TAG, ('nav_builder',)), 'navcoin': (NAV_VERSION, NAV_VERSION_TAG, ('nav_builder',)),
} }
disabled_coins = [
'navcoin',
]
expected_key_ids = { expected_key_ids = {
'tecnovert': ('13F13651C9CF0D6B',), 'tecnovert': ('13F13651C9CF0D6B',),
'thrasher': ('FE3348877809386C',), 'thrasher': ('FE3348877809386C',),
@ -1050,7 +1055,8 @@ def printVersion():
logger.info('Core versions:') logger.info('Core versions:')
for coin, version in known_coins.items(): for coin, version in known_coins.items():
logger.info('\t%s: %s%s', coin, version[0], version[1]) postfix = ' (Disabled)' if coin in disabled_coins else ''
logger.info('\t%s: %s%s%s', coin.capitalize(), version[0], version[1], postfix)
def printHelp(): def printHelp():
@ -1086,7 +1092,11 @@ def printHelp():
print('--initwalletsonly Setup coin wallets only.') print('--initwalletsonly Setup coin wallets only.')
print('--keysdirpath Speed up tests by preloading all PGP keys in directory.') print('--keysdirpath Speed up tests by preloading all PGP keys in directory.')
print('\n' + 'Known coins: {}'.format(', '.join(known_coins.keys()))) active_coins = []
for coin_name in known_coins.keys():
if coin_name not in disabled_coins:
active_coins.append(coin_name)
print('\n' + 'Known coins: {}'.format(', '.join(active_coins)))
def finalise_daemon(d): def finalise_daemon(d):
@ -1266,6 +1276,13 @@ def check_btc_fastsync_data(base_dir, sync_file_path):
ensureValidSignatureBy(verified, 'tecnovert') ensureValidSignatureBy(verified, 'tecnovert')
def ensure_coin_valid(coin: str, test_disabled: bool = True) -> None:
if coin not in known_coins:
exitWithError(f'Unknown coin {coin.capitalize()}')
if test_disabled and not OVERRIDE_DISABLED_COINS and coin in disabled_coins:
exitWithError(f'{coin.capitalize()} is disabled')
def main(): def main():
global use_tor_proxy global use_tor_proxy
data_dir = None data_dir = None
@ -1365,28 +1382,24 @@ def main():
continue continue
if name == 'withcoin' or name == 'withcoins': if name == 'withcoin' or name == 'withcoins':
for coin in [s.lower() for s in s[1].split(',')]: for coin in [s.lower() for s in s[1].split(',')]:
if coin not in known_coins: ensure_coin_valid(coin)
exitWithError('Unknown coin {}'.format(coin))
with_coins.add(coin) with_coins.add(coin)
coins_changed = True coins_changed = True
continue continue
if name == 'withoutcoin' or name == 'withoutcoins': if name == 'withoutcoin' or name == 'withoutcoins':
for coin in [s.lower() for s in s[1].split(',')]: for coin in [s.lower() for s in s[1].split(',')]:
if coin not in known_coins: ensure_coin_valid(coin, test_disabled=False)
exitWithError('Unknown coin {}'.format(coin))
with_coins.discard(coin) with_coins.discard(coin)
coins_changed = True coins_changed = True
continue continue
if name == 'addcoin': if name == 'addcoin':
add_coin = s[1].lower() add_coin = s[1].lower()
if add_coin not in known_coins: ensure_coin_valid(add_coin)
exitWithError('Unknown coin {}'.format(s[1]))
with_coins = {add_coin, } with_coins = {add_coin, }
continue continue
if name == 'disablecoin': if name == 'disablecoin':
disable_coin = s[1].lower() disable_coin = s[1].lower()
if disable_coin not in known_coins: ensure_coin_valid(disable_coin, test_disabled=False)
exitWithError('Unknown coin {}'.format(s[1]))
continue continue
if name == 'htmlhost': if name == 'htmlhost':
htmlhost = s[1].strip('"') htmlhost = s[1].strip('"')
@ -1677,9 +1690,13 @@ def main():
settings = load_config(config_path) settings = load_config(config_path)
if disable_coin not in settings['chainclients']: if disable_coin not in settings['chainclients']:
exitWithError('{} has not been prepared'.format(disable_coin)) exitWithError(f'{disable_coin} not configured')
settings['chainclients'][disable_coin]['connection_type'] = 'none'
settings['chainclients'][disable_coin]['manage_daemon'] = False coin_settings = settings['chainclients'][disable_coin]
if coin_settings['connection_type'] == 'none' and coin_settings['manage_daemon'] is False:
exitWithError(f'{disable_coin} is already disabled')
coin_settings['connection_type'] = 'none'
coin_settings['manage_daemon'] = False
with open(config_path, 'w') as fp: with open(config_path, 'w') as fp:
json.dump(settings, fp, indent=4) json.dump(settings, fp, indent=4)

View File

@ -1,3 +1,10 @@
0.0.68
==============
- Temporarily disabled Navcoin.
- Untested on mainnet.
0.0.67 0.0.67
============== ==============