mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-23 03:49:25 +00:00
xmr: Set daemon-address from basicswap.json
This commit is contained in:
parent
fafcfa4731
commit
9cb69e3f5b
3 changed files with 29 additions and 5 deletions
|
@ -19,7 +19,7 @@
|
|||
<tr><td>Coin To</td><td>{{ data.coin_to }}</td></tr>
|
||||
<tr><td>Amount From</td><td>{{ data.amt_from }} {{ data.tla_from }}</td></tr>
|
||||
<tr><td>Amount To</td><td>{{ data.amt_to }} {{ data.tla_to }}</td></tr>
|
||||
<tr><td>Rate</td><td>{{ data.rate }} {{ data.amt_from }}/{{ data.tla_from }}</td></tr>
|
||||
<tr><td>Rate</td><td>{{ data.rate }}</td></tr>
|
||||
<tr><td>Amount Variable</td><td>{{ data.amount_negotiable }}</td></tr>
|
||||
<tr><td>Rate Variable</td><td>{{ data.rate_negotiable }}</td></tr>
|
||||
<tr><td>Script Lock Type</td><td>{{ data.lock_type }}</td></tr>
|
||||
|
|
|
@ -350,7 +350,7 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic):
|
|||
if os.path.exists(wallet_conf_path):
|
||||
exitWithError('{} exists'.format(wallet_conf_path))
|
||||
with open(wallet_conf_path, 'w') as fp:
|
||||
fp.write('daemon-address={}:{}\n'.format(core_settings['rpchost'], core_settings['rpcport']))
|
||||
fp.write('untrusted-daemon=1\n')
|
||||
fp.write('no-dns=1\n')
|
||||
fp.write('rpc-bind-port={}\n'.format(core_settings['walletrpcport']))
|
||||
fp.write('rpc-bind-ip={}\n'.format(COINS_BIND_IP))
|
||||
|
|
|
@ -9,6 +9,7 @@ import os
|
|||
import sys
|
||||
import json
|
||||
import time
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import traceback
|
||||
|
@ -60,9 +61,29 @@ def startXmrWalletDaemon(node_dir, bin_dir, wallet_bin, opts=[]):
|
|||
daemon_bin = os.path.expanduser(os.path.join(bin_dir, wallet_bin))
|
||||
|
||||
data_dir = os.path.expanduser(node_dir)
|
||||
args = [daemon_bin, '--non-interactive', '--config-file=' + os.path.join(data_dir, 'monero_wallet.conf')] + opts
|
||||
config_path = os.path.join(data_dir, 'monero_wallet.conf')
|
||||
args = [daemon_bin, '--non-interactive', '--config-file=' + config_path] + opts
|
||||
|
||||
# TODO: Remove
|
||||
# Remove daemon-address
|
||||
has_daemon_address = False
|
||||
has_untrusted = False
|
||||
with open(config_path) as fp:
|
||||
for line in fp:
|
||||
if line.startswith('daemon-address'):
|
||||
has_daemon_address = True
|
||||
if line.startswith('untrusted-daemon'):
|
||||
has_untrusted = True
|
||||
if has_daemon_address:
|
||||
logging.info('Rewriting monero_wallet.conf')
|
||||
shutil.copyfile(config_path, config_path + '.last')
|
||||
with open(config_path + '.last') as fp_from, open(config_path, 'w') as fp_to:
|
||||
for line in fp_from:
|
||||
if not line.startswith('daemon-address'):
|
||||
fp_to.write(line)
|
||||
if not has_untrusted:
|
||||
fp_to.write('untrusted-daemon=1\n')
|
||||
|
||||
args += opts
|
||||
logging.info('Starting wallet daemon {} --wallet-dir={}'.format(daemon_bin, node_dir))
|
||||
|
||||
# TODO: return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=data_dir)
|
||||
|
@ -109,7 +130,10 @@ def runClient(fp, data_dir, chain):
|
|||
|
||||
if v['manage_wallet_daemon'] is True:
|
||||
logger.info('Starting {} wallet daemon'.format(c.capitalize()))
|
||||
daemons.append(startXmrWalletDaemon(v['datadir'], v['bindir'], 'monero-wallet-rpc'))
|
||||
daemon_addr = '{}:{}'.format(v['rpchost'], v['rpcport'])
|
||||
logger.info('daemon-address: {}'.format(daemon_addr))
|
||||
opts = ['--daemon-address', daemon_addr, ]
|
||||
daemons.append(startXmrWalletDaemon(v['datadir'], v['bindir'], 'monero-wallet-rpc', opts))
|
||||
pid = daemons[-1].pid
|
||||
logger.info('Started {} {}'.format('monero-wallet-rpc', pid))
|
||||
|
||||
|
|
Loading…
Reference in a new issue