mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 10:28:10 +01:00
Start reload test
This commit is contained in:
@@ -193,6 +193,8 @@ def prepareDataDir(coin, settings, data_dir, chain, particl_mnemonic):
|
||||
fp.write(chain + '=1\n')
|
||||
if chain == 'testnet':
|
||||
fp.write('[test]\n\n')
|
||||
if chain == 'regtest':
|
||||
fp.write('[regtest]\n\n')
|
||||
else:
|
||||
logger.warning('Unknown chain %s', chain)
|
||||
|
||||
@@ -355,6 +357,7 @@ def main():
|
||||
os.makedirs(data_dir)
|
||||
config_path = os.path.join(data_dir, 'basicswap.json')
|
||||
|
||||
withchainclients = {}
|
||||
chainclients = {
|
||||
'particl': {
|
||||
'connection_type': 'rpc',
|
||||
@@ -452,6 +455,9 @@ def main():
|
||||
if os.path.exists(config_path):
|
||||
exitWithError('{} exists'.format(config_path))
|
||||
|
||||
for c in with_coins:
|
||||
withchainclients[c] = chainclients[c]
|
||||
|
||||
settings = {
|
||||
'debug': True,
|
||||
'zmqhost': 'tcp://127.0.0.1',
|
||||
@@ -460,7 +466,7 @@ def main():
|
||||
'htmlport': 12700 + port_offset,
|
||||
'network_key': '7sW2UEcHXvuqEjkpE5mD584zRaQYs6WXYohue4jLFZPTvMSxwvgs',
|
||||
'network_pubkey': '035758c4a22d7dd59165db02a56156e790224361eb3191f02197addcb3bde903d2',
|
||||
'chainclients': chainclients,
|
||||
'chainclients': withchainclients,
|
||||
'check_progress_seconds': 60,
|
||||
'check_watched_seconds': 60,
|
||||
'check_expired_seconds': 60
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
"""
|
||||
Atomic Swap Client - Proof of Concept
|
||||
|
||||
Dependencies:
|
||||
$ pacman -S python-pyzmq python-plyvel protobuf
|
||||
|
||||
"""
|
||||
|
||||
import sys
|
||||
@@ -50,7 +47,7 @@ def startDaemon(node_dir, bin_dir, daemon_bin, opts=[]):
|
||||
return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
||||
def runClient(fp, data_dir, chain):
|
||||
def runClient(fp, data_dir, chain, test_mode):
|
||||
global swap_client
|
||||
settings_path = os.path.join(data_dir, 'basicswap.json')
|
||||
pids_path = os.path.join(data_dir, '.pids')
|
||||
@@ -87,8 +84,10 @@ def runClient(fp, data_dir, chain):
|
||||
|
||||
swap_client = BasicSwap(fp, data_dir, settings, chain)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
if not test_mode:
|
||||
# signal only works in main thread
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
swap_client.start()
|
||||
|
||||
threads = []
|
||||
@@ -148,12 +147,19 @@ def printVersion():
|
||||
|
||||
|
||||
def printHelp():
|
||||
logger.info('basicswap-run --datadir=path -testnet')
|
||||
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:~/.basicswap.')
|
||||
logger.info('--mainnet Run in mainnet mode.')
|
||||
logger.info('--testnet Run in testnet mode.')
|
||||
logger.info('--regtest Run in regtest mode.')
|
||||
|
||||
|
||||
def main():
|
||||
data_dir = None
|
||||
chain = 'mainnet'
|
||||
test_mode = False
|
||||
|
||||
for v in sys.argv[1:]:
|
||||
if len(v) < 2 or v[0] != '-':
|
||||
@@ -173,6 +179,10 @@ def main():
|
||||
if name == 'h' or name == 'help':
|
||||
printHelp()
|
||||
return 0
|
||||
|
||||
if name == 'testmode':
|
||||
test_mode = True
|
||||
continue
|
||||
if name == 'testnet':
|
||||
chain = 'testnet'
|
||||
continue
|
||||
@@ -198,7 +208,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, test_mode)
|
||||
|
||||
logger.info('Done.')
|
||||
return swap_client.fail_code if swap_client is not None else 0
|
||||
|
||||
Reference in New Issue
Block a user