diff --git a/mmgen/daemon.py b/mmgen/daemon.py index 10225f2e..4e4acbcd 100755 --- a/mmgen/daemon.py +++ b/mmgen/daemon.py @@ -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 diff --git a/mmgen/opts.py b/mmgen/opts.py index 0fe8f888..03018830 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -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'): diff --git a/test/include/coin_daemon_control.py b/test/include/coin_daemon_control.py index abe6c421..58106754 100755 --- a/test/include/coin_daemon_control.py +++ b/test/include/coin_daemon_control.py @@ -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