coins: Update Dash to v20.0.2

This commit is contained in:
tecnovert 2023-12-18 15:15:16 +02:00
parent 0a9db22828
commit 6a26f72bca
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
4 changed files with 80 additions and 50 deletions

View file

@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.12.2"
__version__ = "0.12.3"

View file

@ -55,7 +55,7 @@ XMR_SITE_COMMIT = 'a3b195eb90c7d5564cc9d9ec09c873783d21901b' # Lock hashes.txt
PIVX_VERSION = os.getenv('PIVX_VERSION', '5.5.0')
PIVX_VERSION_TAG = os.getenv('PIVX_VERSION_TAG', '')
DASH_VERSION = os.getenv('DASH_VERSION', '19.3.0')
DASH_VERSION = os.getenv('DASH_VERSION', '20.0.2')
DASH_VERSION_TAG = os.getenv('DASH_VERSION_TAG', '')
FIRO_VERSION = os.getenv('FIRO_VERSION', '0.14.13.0')
@ -203,6 +203,11 @@ default_socket_timeout = socket.getdefaulttimeout()
default_socket_getaddrinfo = socket.getaddrinfo
def exitWithError(error_msg):
sys.stderr.write('Error: {}, exiting.\n'.format(error_msg))
sys.exit(1)
def make_reporthook(read_start=0):
read = read_start # Number of bytes read so far
last_percent_str = ''
@ -618,7 +623,7 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
release_filename = '{}-{}-{}.{}'.format('dashcore', version + version_tag, BIN_ARCH, FILE_EXT)
release_url = 'https://github.com/dashpay/dash/releases/download/v{}/{}'.format(version + version_tag, release_filename)
assert_filename = '{}-{}-{}-build.assert'.format(coin, os_name, major_version)
assert_url = 'https://raw.githubusercontent.com/dashpay/gitian.sigs/master/%s-%s/%s/%s' % (version + version_tag, os_dir_name, signing_key_name, assert_filename)
assert_url = f'https://raw.githubusercontent.com/dashpay/guix.sigs/master/{version}/{signing_key_name}/codesigned.SHA256SUMS'
elif coin == 'firo':
arch_name = BIN_ARCH
'''
@ -653,7 +658,8 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
downloadFile(assert_url, assert_path)
if coin not in ('firo', ):
assert_sig_url = assert_url + ('.asc' if major_version >= 22 else '.sig')
use_guix: bool = coin in ('dash', ) or major_version >= 22
assert_sig_url = assert_url + ('.asc' if use_guix else '.sig')
if coin not in ('nav', ):
assert_sig_filename = '{}-{}-{}-build-{}.assert.sig'.format(coin, os_name, version, signing_key_name)
assert_sig_path = os.path.join(bin_dir, assert_sig_filename)
@ -1045,11 +1051,6 @@ def modify_tor_config(settings, coin, tor_control_password=None, enable=False):
writeTorSettings(fp, coin, coin_settings, tor_control_password)
def exitWithError(error_msg):
sys.stderr.write('Error: {}, exiting.\n'.format(error_msg))
sys.exit(1)
def printVersion():
logger.info(f'Basicswap version: {__version__}')
@ -1329,13 +1330,9 @@ def main():
if name == 'h' or name == 'help':
printHelp()
return 0
if name == 'mainnet':
continue
if name == 'testnet':
chain = 'testnet'
continue
if name == 'regtest':
chain = 'regtest'
if name in ('mainnet', 'testnet', 'regtest'):
chain = name
continue
if name == 'preparebinonly':
prepare_bin_only = True
@ -1380,13 +1377,13 @@ def main():
if name == 'particl_mnemonic':
particl_wallet_mnemonic = s[1].strip('"')
continue
if name == 'withcoin' or name == 'withcoins':
if name in ('withcoin', 'withcoins'):
for coin in [s.lower() for s in s[1].split(',')]:
ensure_coin_valid(coin)
with_coins.add(coin)
coins_changed = True
continue
if name == 'withoutcoin' or name == 'withoutcoins':
if name in ('withoutcoin', 'withoutcoins'):
for coin in [s.lower() for s in s[1].split(',')]:
ensure_coin_valid(coin, test_disabled=False)
with_coins.discard(coin)

View file

@ -21,12 +21,25 @@ from basicswap.basicswap import BasicSwap
from basicswap.http_server import HttpThread
from basicswap.contrib.websocket_server import WebsocketServer
logger = logging.getLogger()
logger.level = logging.DEBUG
if not len(logger.handlers):
logger.addHandler(logging.StreamHandler(sys.stdout))
swap_client = None
# TODO: deduplicate
known_coins = [
'particl',
'litecoin',
'bitcoin',
'namecoin',
'monero',
'pivx',
'dash',
'firo',
'navcoin',
]
def signal_handler(sig, frame):
@ -112,7 +125,7 @@ def ws_message_received(client, server, message):
swap_client.log.debug(f'ws_message_received {client["id"]} {message}')
def runClient(fp, data_dir, chain):
def runClient(fp, data_dir, chain, start_only_coins):
global swap_client
daemons = []
pids = []
@ -143,6 +156,9 @@ def runClient(fp, data_dir, chain):
try:
# Try start daemons
for c, v in settings['chainclients'].items():
if len(start_only_coins) > 0 and c not in start_only_coins:
continue
try:
coin_id = swap_client.getCoinIdFromName(c)
display_name = getCoinName(coin_id)
@ -189,28 +205,33 @@ def runClient(fp, data_dir, chain):
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
swap_client.start()
if 'htmlhost' in settings:
swap_client.log.info('Starting http server at http://%s:%d.' % (settings['htmlhost'], settings['htmlport']))
allow_cors = settings['allowcors'] if 'allowcors' in settings else cfg.DEFAULT_ALLOW_CORS
thread_http = HttpThread(fp, settings['htmlhost'], settings['htmlport'], allow_cors, swap_client)
threads.append(thread_http)
thread_http.start()
if len(start_only_coins) > 0:
logger.info(f'Only running {start_only_coins}. Manually exit with Ctrl + c when ready.')
while not swap_client.delay_event.wait(0.5):
pass
else:
swap_client.start()
if 'htmlhost' in settings:
swap_client.log.info('Starting http server at http://%s:%d.' % (settings['htmlhost'], settings['htmlport']))
allow_cors = settings['allowcors'] if 'allowcors' in settings else cfg.DEFAULT_ALLOW_CORS
thread_http = HttpThread(fp, settings['htmlhost'], settings['htmlport'], allow_cors, swap_client)
threads.append(thread_http)
thread_http.start()
if 'wshost' in settings:
ws_url = 'ws://{}:{}'.format(settings['wshost'], settings['wsport'])
swap_client.log.info(f'Starting ws server at {ws_url}.')
if 'wshost' in settings:
ws_url = 'ws://{}:{}'.format(settings['wshost'], settings['wsport'])
swap_client.log.info(f'Starting ws server at {ws_url}.')
swap_client.ws_server = WebsocketServer(host=settings['wshost'], port=settings['wsport'])
swap_client.ws_server.set_fn_new_client(ws_new_client)
swap_client.ws_server.set_fn_client_left(ws_client_left)
swap_client.ws_server.set_fn_message_received(ws_message_received)
swap_client.ws_server.run_forever(threaded=True)
swap_client.ws_server = WebsocketServer(host=settings['wshost'], port=settings['wsport'])
swap_client.ws_server.set_fn_new_client(ws_new_client)
swap_client.ws_server.set_fn_client_left(ws_client_left)
swap_client.ws_server.set_fn_message_received(ws_message_received)
swap_client.ws_server.run_forever(threaded=True)
logger.info('Exit with Ctrl + c.')
while not swap_client.delay_event.wait(0.5):
swap_client.update()
logger.info('Exit with Ctrl + c.')
while not swap_client.delay_event.wait(0.5):
swap_client.update()
except Exception as ex:
traceback.print_exc()
@ -267,18 +288,20 @@ def printVersion():
def printHelp():
logger.info('Usage: basicswap-run ')
logger.info('\n--help, -h Print help.')
logger.info('--version, -v Print version.')
logger.info('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
logger.info('--mainnet Run in mainnet mode.')
logger.info('--testnet Run in testnet mode.')
logger.info('--regtest Run in regtest mode.')
print('Usage: basicswap-run ')
print('\n--help, -h Print help.')
print('--version, -v Print version.')
print('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
print('--mainnet Run in mainnet mode.')
print('--testnet Run in testnet mode.')
print('--regtest Run in regtest mode.')
print('--startonlycoin Only start the provides coin daemon/s, use this if a chain requires extra processing.')
def main():
data_dir = None
chain = 'mainnet'
start_only_coins = set()
for v in sys.argv[1:]:
if len(v) < 2 or v[0] != '-':
@ -299,17 +322,20 @@ def main():
printHelp()
return 0
if name == 'testnet':
chain = 'testnet'
continue
if name == 'regtest':
chain = 'regtest'
if name in ('mainnet', 'testnet', 'regtest'):
chain = name
continue
if len(s) == 2:
if name == 'datadir':
data_dir = os.path.expanduser(s[1])
continue
if name == 'startonlycoin':
for coin in [s.lower() for s in s[1].split(',')]:
if coin not in known_coins:
raise ValueError(f'Unknown coin: {coin}')
start_only_coins.add(coin)
continue
logger.warning('Unknown argument %s', v)
@ -323,7 +349,7 @@ def main():
with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp:
logger.info(os.path.basename(sys.argv[0]) + ', version: ' + __version__ + '\n\n')
runClient(fp, data_dir, chain)
runClient(fp, data_dir, chain, start_only_coins)
logger.info('Done.')
return swap_client.fail_code if swap_client is not None else 0

View file

@ -1,3 +1,10 @@
0.12.3
==============
- New basicswap-run parameter startonlycoin.
- If set basicswap-run will only start the specified coin daemon/s.
0.12.2
==============