opts.py: add check for --daemon-id
This commit is contained in:
parent
5ca832a9a5
commit
54f436c25a
3 changed files with 12 additions and 1 deletions
|
|
@ -271,6 +271,10 @@ class CoinDaemon(Daemon):
|
|||
'ETC': _cd('Ethereum Classic', networks, ['parity']),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def all_daemon_ids(cls):
|
||||
return [i for coin in cls.coins for i in cls.coins[coin].daemon_ids]
|
||||
|
||||
@classmethod
|
||||
def get_network_ids(cls): # FIXME: gets IDs for _default_ daemon only
|
||||
from .protocol import CoinProtocol
|
||||
|
|
|
|||
|
|
@ -578,6 +578,10 @@ def check_usr_opts(usr_opts): # Raises an exception if any check fails
|
|||
from .util import ymsg
|
||||
ymsg(f'Adjusting transaction vsize by a factor of {float(val):1.2f}')
|
||||
|
||||
def chk_daemon_id(key,val,desc):
|
||||
from .daemon import CoinDaemon
|
||||
opt_is_in_list(val,CoinDaemon.all_daemon_ids(),desc)
|
||||
|
||||
# TODO: move this check elsewhere
|
||||
# def chk_rbf(key,val,desc):
|
||||
# if not proto.cap('rbf'):
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ opts_data = {
|
|||
--, --longhelp Print help message for long options (common options)
|
||||
-D, --debug Produce debugging output (implies --verbose)
|
||||
-d, --datadir= Override the default datadir
|
||||
-i, --daemon-ids Print all known daemon IDs
|
||||
-n, --no-daemonize Don't fork daemon to background
|
||||
-p, --port-shift= Shift the RPC port by this number
|
||||
-s, --get-state Get the state of the daemon(s) and exit
|
||||
|
|
@ -60,7 +61,9 @@ def run(network_id=None,proto=None,daemon_id=None):
|
|||
else:
|
||||
d.cmd(action,quiet=opt.quiet)
|
||||
|
||||
if 'all' in cmd_args or 'no_xmr' in cmd_args:
|
||||
if opt.daemon_ids:
|
||||
print('\n'.join(CoinDaemon.all_daemon_ids()))
|
||||
elif 'all' in cmd_args or 'no_xmr' in cmd_args:
|
||||
if len(cmd_args) != 1:
|
||||
die(1,"'all' or 'no_xmr' must be the sole argument")
|
||||
from mmgen.protocol import init_proto
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue