Rationale: to enable communication with multiple coin daemons on multiple hosts
in a single program invocation, making possible the implementation of asset
swap functionality, for instance
Coin-specific options are prefixed with a coin symbol, proto-specific options
with a coin symbol plus a network name.
Coin- and protocol-specific options override their non-prefixed counterparts.
They are available via the command line, configuration file and Config API.
Currently available options:
Option Supported Prefixes
tw_name btc ltc bch
rpc_user btc ltc bch
rpc_password btc ltc bch
rpc_host btc ltc bch eth etc
rpc_port btc ltc bch eth etc xmr
ignore_daemon_version btc ltc bch eth etc xmr
max_tx_fee btc ltc bch eth etc
chain_names eth_mainnet eth_testnet etc_mainnet etc_testnet
Example:
$ mmgen-tool --coin=ltc --ltc-tw-name=ltc2 --ltc-ignore-daemon-version twview
Help:
$ mmgen-tool --longhelp
$ view mmgen/data/mmgen.cfg
Testing:
$ test/daemontest.py rpc.btc rpc.geth
$ test/cmdtest.py help opts cfgfile
- all options without parameters may be negated by prefixing the option name
with ‘no-’
- if the option name itself begins with ‘no-’, then the option is negated
by removing the ‘no-’ prefix
- negation may be used to override options set in the cfg file
- command-line options may also be overridden, with the last-listed option
taking precedence
- as with ordinary options, substring matching is supported
Examples:
OPTION NEGATED OPTION
--no-license --license
--no-license --lic
--quiet --no-quiet
--quiet --no-q
Testing:
$ test/cmdtest.py opts cfgfile
- command-line options are now parsed natively, without use of the getopt module
- global options and --longhelp helpscreen are now contextual, depending on coin
and executed command
- commands invoked with out-of-context global options (e.g. `mmgen-walletgen
--coin=btc`) now fail with an ‘unrecognized option’ error
Testing:
$ test/test-release.sh help
$ test/cmdtest.py opts
This patch eliminates the global configuration variables `opt` and `g`, making
all functions and class instances locally configurable. Configuration data is
passed to functions and constructors via the `cfg` parameter and made available
to methods in `self.cfg`.
Local configuration free from dependence on the command line will enable the
creation of multiple, independently configured instances of MMGen’s data
objects within a single process.
Potential applications include testing (tracking wallets configured to interact
with spawned processes, for example) and the use of MMGen as a library for
other projects.
This patch completes most of the work required to enable the API. The full
implementation will appear in a forthcoming commit.
- The attributes of GlobalConstants are non-configurable. They’re constant
for a given machine, user, executable and MMGen release.
- The attributes of GlobalVars, `stderr` and `stdout`, are used by the test
suite to redirect msg() and friends to /dev/null.
- All the aforementioned attributes formerly belonged to GlobalConfig.