mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-23 03:49:25 +00:00
Fix testnet mode, expanduser on paths.
This commit is contained in:
parent
5bfcdd469b
commit
e039d90bee
3 changed files with 18 additions and 9 deletions
|
@ -531,7 +531,9 @@ class BasicSwap():
|
|||
def setDefaultConnectParams(self, coin):
|
||||
chain_client_settings = self.getChainClientSettings(coin)
|
||||
|
||||
datadir = chain_client_settings.get('datadir', os.path.join(cfg.DATADIRS, chainparams[coin]['name']))
|
||||
bindir = os.path.expanduser(chain_client_settings.get('bindir', ''))
|
||||
datadir = os.path.expanduser(chain_client_settings.get('datadir', os.path.join(cfg.DATADIRS, chainparams[coin]['name'])))
|
||||
|
||||
blocks_confirmed = chain_client_settings.get('blocks_confirmed', 6)
|
||||
connection_type = chain_client_settings.get('connection_type', 'none')
|
||||
use_segwit = chain_client_settings.get('use_segwit', False)
|
||||
|
@ -543,8 +545,11 @@ class BasicSwap():
|
|||
elif 'rpcpassword' in chain_client_settings:
|
||||
rpcauth = chain_client_settings['rpcuser'] + ':' + chain_client_settings['rpcpassword']
|
||||
if rpcauth is None:
|
||||
testnet_name = '' if self.chain == 'mainnet' else self.chain
|
||||
if testnet_name == 'testnet' and coin != Coins.PART:
|
||||
testnet_name += '4'
|
||||
authcookiepath = os.path.join(datadir, testnet_name, '.cookie')
|
||||
# Wait for daemon to start
|
||||
authcookiepath = os.path.join(datadir, '' if self.chain == 'mainnet' else self.chain, '.cookie')
|
||||
for i in range(10):
|
||||
if not os.path.exists(authcookiepath):
|
||||
time.sleep(0.5)
|
||||
|
@ -565,6 +570,7 @@ class BasicSwap():
|
|||
return {
|
||||
'coin': coin,
|
||||
'connection_type': connection_type,
|
||||
'bindir': bindir,
|
||||
'datadir': datadir,
|
||||
'rpcport': chain_client_settings.get('rpcport', chainparams[coin][self.chain]['rpcport']),
|
||||
'rpcauth': rpcauth,
|
||||
|
@ -2242,8 +2248,7 @@ class BasicSwap():
|
|||
return callrpc(self.coin_clients[coin]['rpcport'], self.coin_clients[coin]['rpcauth'], method, params, wallet)
|
||||
|
||||
def calltx(self, cmd):
|
||||
settings = self.getChainClientSettings(Coins.PART)
|
||||
bindir = settings.get('bindir', '')
|
||||
bindir = self.coin_clients[Coins.PART]['bindir']
|
||||
command_cli = os.path.join(bindir, cfg.PARTICL_TX)
|
||||
chainname = '' if self.chain == 'mainnet' else (' -' + self.chain)
|
||||
args = command_cli + chainname + ' ' + cmd
|
||||
|
|
|
@ -92,14 +92,14 @@ def prepareCore(coin, version, settings, data_dir):
|
|||
elif coin == 'litecoin':
|
||||
signing_key_name = 'thrasher'
|
||||
release_url = 'https://download.litecoin.org/litecoin-{}/{}/{}'.format(version, os_name, release_filename)
|
||||
assert_filename = '{}-{}-{}-build.assert'.format(coin, os_name, version.rsplit('.',1)[0])
|
||||
assert_filename = '{}-{}-{}-build.assert'.format(coin, os_name, version.rsplit('.', 1)[0])
|
||||
assert_url = 'https://raw.githubusercontent.com/litecoin-project/gitian.sigs.ltc/master/%s-%s/%s/%s' % (version, os_name, signing_key_name, assert_filename)
|
||||
assert_sig_filename = assert_filename + '.sig'
|
||||
assert_sig_url = assert_url + '.sig'
|
||||
elif coin == 'bitcoin':
|
||||
signing_key_name = 'laanwj'
|
||||
release_url = 'https://bitcoincore.org/bin/bitcoin-core-{}/{}'.format(version, release_filename)
|
||||
assert_filename = '{}-{}-{}-build.assert'.format(coin, os_name, version.rsplit('.',1)[0])
|
||||
assert_filename = '{}-{}-{}-build.assert'.format(coin, os_name, version.rsplit('.', 1)[0])
|
||||
assert_url = 'https://raw.githubusercontent.com/bitcoin-core/gitian.sigs/master/%s-%s/%s/%s' % (version, os_name, signing_key_name, assert_filename)
|
||||
assert_sig_filename = assert_filename + '.sig'
|
||||
assert_sig_url = assert_url + '.sig'
|
||||
|
@ -331,7 +331,11 @@ def main():
|
|||
|
||||
with open(core_conf_path, 'w') as fp:
|
||||
if chain != 'mainnet':
|
||||
fp.write(chain + '=1\n\n')
|
||||
fp.write(chain + '=1\n')
|
||||
if chain == 'testnet':
|
||||
fp.write('[test]\n\n')
|
||||
else:
|
||||
logger.warning('Unknown chain %s', chain)
|
||||
|
||||
fp.write('rpcport={}\n'.format(core_settings['rpcport']))
|
||||
fp.write('printtoconsole=0\n')
|
||||
|
|
|
@ -44,9 +44,9 @@ def signal_handler(sig, frame):
|
|||
|
||||
|
||||
def startDaemon(node_dir, bin_dir, daemon_bin, opts=[]):
|
||||
daemon_bin = os.path.join(bin_dir, daemon_bin)
|
||||
daemon_bin = os.path.expanduser(os.path.join(bin_dir, daemon_bin))
|
||||
|
||||
args = [daemon_bin, '-datadir=' + node_dir] + opts
|
||||
args = [daemon_bin, '-datadir=' + os.path.expanduser(node_dir)] + opts
|
||||
logger.info('Starting node ' + daemon_bin + ' ' + '-datadir=' + node_dir)
|
||||
return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
|
|
Loading…
Reference in a new issue