mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-23 03:49:25 +00:00
coins: Update Dash to v20.0.2
This commit is contained in:
parent
0a9db22828
commit
6a26f72bca
4 changed files with 80 additions and 50 deletions
|
@ -1,3 +1,3 @@
|
||||||
name = "basicswap"
|
name = "basicswap"
|
||||||
|
|
||||||
__version__ = "0.12.2"
|
__version__ = "0.12.3"
|
||||||
|
|
|
@ -55,7 +55,7 @@ XMR_SITE_COMMIT = 'a3b195eb90c7d5564cc9d9ec09c873783d21901b' # Lock hashes.txt
|
||||||
PIVX_VERSION = os.getenv('PIVX_VERSION', '5.5.0')
|
PIVX_VERSION = os.getenv('PIVX_VERSION', '5.5.0')
|
||||||
PIVX_VERSION_TAG = os.getenv('PIVX_VERSION_TAG', '')
|
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', '')
|
DASH_VERSION_TAG = os.getenv('DASH_VERSION_TAG', '')
|
||||||
|
|
||||||
FIRO_VERSION = os.getenv('FIRO_VERSION', '0.14.13.0')
|
FIRO_VERSION = os.getenv('FIRO_VERSION', '0.14.13.0')
|
||||||
|
@ -203,6 +203,11 @@ default_socket_timeout = socket.getdefaulttimeout()
|
||||||
default_socket_getaddrinfo = socket.getaddrinfo
|
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):
|
def make_reporthook(read_start=0):
|
||||||
read = read_start # Number of bytes read so far
|
read = read_start # Number of bytes read so far
|
||||||
last_percent_str = ''
|
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_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)
|
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_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':
|
elif coin == 'firo':
|
||||||
arch_name = BIN_ARCH
|
arch_name = BIN_ARCH
|
||||||
'''
|
'''
|
||||||
|
@ -653,7 +658,8 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
|
||||||
downloadFile(assert_url, assert_path)
|
downloadFile(assert_url, assert_path)
|
||||||
|
|
||||||
if coin not in ('firo', ):
|
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', ):
|
if coin not in ('nav', ):
|
||||||
assert_sig_filename = '{}-{}-{}-build-{}.assert.sig'.format(coin, os_name, version, signing_key_name)
|
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)
|
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)
|
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():
|
def printVersion():
|
||||||
logger.info(f'Basicswap version: {__version__}')
|
logger.info(f'Basicswap version: {__version__}')
|
||||||
|
|
||||||
|
@ -1329,13 +1330,9 @@ def main():
|
||||||
if name == 'h' or name == 'help':
|
if name == 'h' or name == 'help':
|
||||||
printHelp()
|
printHelp()
|
||||||
return 0
|
return 0
|
||||||
if name == 'mainnet':
|
|
||||||
continue
|
if name in ('mainnet', 'testnet', 'regtest'):
|
||||||
if name == 'testnet':
|
chain = name
|
||||||
chain = 'testnet'
|
|
||||||
continue
|
|
||||||
if name == 'regtest':
|
|
||||||
chain = 'regtest'
|
|
||||||
continue
|
continue
|
||||||
if name == 'preparebinonly':
|
if name == 'preparebinonly':
|
||||||
prepare_bin_only = True
|
prepare_bin_only = True
|
||||||
|
@ -1380,13 +1377,13 @@ def main():
|
||||||
if name == 'particl_mnemonic':
|
if name == 'particl_mnemonic':
|
||||||
particl_wallet_mnemonic = s[1].strip('"')
|
particl_wallet_mnemonic = s[1].strip('"')
|
||||||
continue
|
continue
|
||||||
if name == 'withcoin' or name == 'withcoins':
|
if name in ('withcoin', 'withcoins'):
|
||||||
for coin in [s.lower() for s in s[1].split(',')]:
|
for coin in [s.lower() for s in s[1].split(',')]:
|
||||||
ensure_coin_valid(coin)
|
ensure_coin_valid(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 in ('withoutcoin', 'withoutcoins'):
|
||||||
for coin in [s.lower() for s in s[1].split(',')]:
|
for coin in [s.lower() for s in s[1].split(',')]:
|
||||||
ensure_coin_valid(coin, test_disabled=False)
|
ensure_coin_valid(coin, test_disabled=False)
|
||||||
with_coins.discard(coin)
|
with_coins.discard(coin)
|
||||||
|
|
|
@ -21,12 +21,25 @@ from basicswap.basicswap import BasicSwap
|
||||||
from basicswap.http_server import HttpThread
|
from basicswap.http_server import HttpThread
|
||||||
from basicswap.contrib.websocket_server import WebsocketServer
|
from basicswap.contrib.websocket_server import WebsocketServer
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
if not len(logger.handlers):
|
if not len(logger.handlers):
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
|
||||||
swap_client = None
|
swap_client = None
|
||||||
|
# TODO: deduplicate
|
||||||
|
known_coins = [
|
||||||
|
'particl',
|
||||||
|
'litecoin',
|
||||||
|
'bitcoin',
|
||||||
|
'namecoin',
|
||||||
|
'monero',
|
||||||
|
'pivx',
|
||||||
|
'dash',
|
||||||
|
'firo',
|
||||||
|
'navcoin',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
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}')
|
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
|
global swap_client
|
||||||
daemons = []
|
daemons = []
|
||||||
pids = []
|
pids = []
|
||||||
|
@ -143,6 +156,9 @@ def runClient(fp, data_dir, chain):
|
||||||
try:
|
try:
|
||||||
# Try start daemons
|
# Try start daemons
|
||||||
for c, v in settings['chainclients'].items():
|
for c, v in settings['chainclients'].items():
|
||||||
|
|
||||||
|
if len(start_only_coins) > 0 and c not in start_only_coins:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
coin_id = swap_client.getCoinIdFromName(c)
|
coin_id = swap_client.getCoinIdFromName(c)
|
||||||
display_name = getCoinName(coin_id)
|
display_name = getCoinName(coin_id)
|
||||||
|
@ -189,28 +205,33 @@ def runClient(fp, data_dir, chain):
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
signal.signal(signal.SIGTERM, signal_handler)
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
swap_client.start()
|
|
||||||
|
|
||||||
if 'htmlhost' in settings:
|
if len(start_only_coins) > 0:
|
||||||
swap_client.log.info('Starting http server at http://%s:%d.' % (settings['htmlhost'], settings['htmlport']))
|
logger.info(f'Only running {start_only_coins}. Manually exit with Ctrl + c when ready.')
|
||||||
allow_cors = settings['allowcors'] if 'allowcors' in settings else cfg.DEFAULT_ALLOW_CORS
|
while not swap_client.delay_event.wait(0.5):
|
||||||
thread_http = HttpThread(fp, settings['htmlhost'], settings['htmlport'], allow_cors, swap_client)
|
pass
|
||||||
threads.append(thread_http)
|
else:
|
||||||
thread_http.start()
|
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:
|
if 'wshost' in settings:
|
||||||
ws_url = 'ws://{}:{}'.format(settings['wshost'], settings['wsport'])
|
ws_url = 'ws://{}:{}'.format(settings['wshost'], settings['wsport'])
|
||||||
swap_client.log.info(f'Starting ws server at {ws_url}.')
|
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 = WebsocketServer(host=settings['wshost'], port=settings['wsport'])
|
||||||
swap_client.ws_server.set_fn_new_client(ws_new_client)
|
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_client_left(ws_client_left)
|
||||||
swap_client.ws_server.set_fn_message_received(ws_message_received)
|
swap_client.ws_server.set_fn_message_received(ws_message_received)
|
||||||
swap_client.ws_server.run_forever(threaded=True)
|
swap_client.ws_server.run_forever(threaded=True)
|
||||||
|
|
||||||
logger.info('Exit with Ctrl + c.')
|
logger.info('Exit with Ctrl + c.')
|
||||||
while not swap_client.delay_event.wait(0.5):
|
while not swap_client.delay_event.wait(0.5):
|
||||||
swap_client.update()
|
swap_client.update()
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
@ -267,18 +288,20 @@ def printVersion():
|
||||||
|
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
logger.info('Usage: basicswap-run ')
|
print('Usage: basicswap-run ')
|
||||||
logger.info('\n--help, -h Print help.')
|
print('\n--help, -h Print help.')
|
||||||
logger.info('--version, -v Print version.')
|
print('--version, -v Print version.')
|
||||||
logger.info('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
|
print('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
|
||||||
logger.info('--mainnet Run in mainnet mode.')
|
print('--mainnet Run in mainnet mode.')
|
||||||
logger.info('--testnet Run in testnet mode.')
|
print('--testnet Run in testnet mode.')
|
||||||
logger.info('--regtest Run in regtest 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():
|
def main():
|
||||||
data_dir = None
|
data_dir = None
|
||||||
chain = 'mainnet'
|
chain = 'mainnet'
|
||||||
|
start_only_coins = set()
|
||||||
|
|
||||||
for v in sys.argv[1:]:
|
for v in sys.argv[1:]:
|
||||||
if len(v) < 2 or v[0] != '-':
|
if len(v) < 2 or v[0] != '-':
|
||||||
|
@ -299,17 +322,20 @@ def main():
|
||||||
printHelp()
|
printHelp()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if name == 'testnet':
|
if name in ('mainnet', 'testnet', 'regtest'):
|
||||||
chain = 'testnet'
|
chain = name
|
||||||
continue
|
|
||||||
if name == 'regtest':
|
|
||||||
chain = 'regtest'
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if len(s) == 2:
|
if len(s) == 2:
|
||||||
if name == 'datadir':
|
if name == 'datadir':
|
||||||
data_dir = os.path.expanduser(s[1])
|
data_dir = os.path.expanduser(s[1])
|
||||||
continue
|
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)
|
logger.warning('Unknown argument %s', v)
|
||||||
|
|
||||||
|
@ -323,7 +349,7 @@ def main():
|
||||||
|
|
||||||
with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp:
|
with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp:
|
||||||
logger.info(os.path.basename(sys.argv[0]) + ', version: ' + __version__ + '\n\n')
|
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.')
|
logger.info('Done.')
|
||||||
return swap_client.fail_code if swap_client is not None else 0
|
return swap_client.fail_code if swap_client is not None else 0
|
||||||
|
|
|
@ -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
|
0.12.2
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue