CoinDaemon: support multiple daemons per coin
- specify the daemon via the --daemon-id option
This commit is contained in:
parent
1575b30cd4
commit
dfc732ac5d
3 changed files with 9 additions and 2 deletions
|
|
@ -345,7 +345,12 @@ class CoinDaemon(Daemon):
|
|||
coin,network = CoinProtocol.Base.parse_network_id(network_id)
|
||||
coin = coin.upper()
|
||||
|
||||
daemon_id = cls.coins[coin].daemon_ids[0]
|
||||
daemon_ids = cls.coins[coin].daemon_ids
|
||||
daemon_id = g.daemon_id or daemon_ids[0]
|
||||
|
||||
if daemon_id not in daemon_ids:
|
||||
die(1,f'{daemon_id!r}: invalid daemon_id - valid choices: {fmt_list(daemon_ids)}')
|
||||
|
||||
me = Daemon.__new__(globals()[daemon_id + '_daemon'])
|
||||
assert network in me.networks, f'{network!r}: unsupported network for daemon {daemon_id}'
|
||||
me.network = network
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ class GlobalContext(Lockable):
|
|||
)
|
||||
data_dir_root,data_dir,cfg_file = None,None,None
|
||||
daemon_data_dir = '' # set by user
|
||||
daemon_id = ''
|
||||
|
||||
# global var sets user opt:
|
||||
global_sets_opt = (
|
||||
|
|
@ -166,7 +167,7 @@ class GlobalContext(Lockable):
|
|||
'rpc_host','rpc_port','rpc_user','rpc_password','rpc_backend','aiohttp_rpc_queue_len',
|
||||
'monero_wallet_rpc_host','monero_wallet_rpc_user','monero_wallet_rpc_password',
|
||||
'daemon_data_dir','force_256_color','regtest','coin','bob','alice',
|
||||
'accept_defaults','token','ignore_daemon_version'
|
||||
'accept_defaults','token','ignore_daemon_version','daemon_id'
|
||||
)
|
||||
# opts initialized to None by opts.init() if not set by user
|
||||
required_opts = (
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ common_opts_data = {
|
|||
--, --force-256-color Force 256-color output when color is enabled
|
||||
--, --data-dir=path Specify {pnm} data directory location
|
||||
--, --daemon-data-dir=path Specify {dn} data directory location
|
||||
--, --daemon-id=ID Specify the coin daemon ID
|
||||
--, --ignore-daemon-version Ignore {dn} version check
|
||||
--, --no-license Suppress the GPL license prompt
|
||||
--, --rpc-host=host Communicate with {dn} running on host 'host'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue