From 1ba9733199da826dd775f05c83676c14c39e9254 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 4 Apr 2023 16:04:12 +0000 Subject: [PATCH] a few minor fixes and cleanups --- mmgen/cfgfile.py | 2 +- mmgen/main_autosign.py | 1 - mmgen/main_tool.py | 2 +- mmgen/opts.py | 2 +- mmgen/proto/eth/params.py | 1 + mmgen/proto/eth/rpc.py | 6 +++--- test/unit_tests.py | 2 +- test/unit_tests_d/ut_flags.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mmgen/cfgfile.py b/mmgen/cfgfile.py index 08b5c208..9c97c3b8 100755 --- a/mmgen/cfgfile.py +++ b/mmgen/cfgfile.py @@ -23,6 +23,7 @@ cfgfile: API for the MMGen runtime configuration file and related files import os,re from collections import namedtuple +from .cfg import gc from .util import msg,ymsg,suf,fmt,fmt_list,oneshot_warning,strip_comment,capfirst def mmgen_cfg_file(cfg,id_str): @@ -188,7 +189,6 @@ class CfgFileSampleSys(cfg_file_sample): else: # self.fn is used for error msgs only, so file need not exist on filesystem self.fn = os.path.join(os.path.dirname(__file__),'data',self.fn_base) - from .cfg import gc self.data = gc.get_mmgen_data_file(self.fn_base).splitlines() def make_metadata(self): diff --git a/mmgen/main_autosign.py b/mmgen/main_autosign.py index 5575ea8f..ace29476 100755 --- a/mmgen/main_autosign.py +++ b/mmgen/main_autosign.py @@ -122,7 +122,6 @@ This command is currently available only on Linux-based platforms. cfg = Config( opts_data = opts_data, - add_opts = ['outdir','passwd_file'], # in _set_ok, so must be set init_opts = { 'quiet': True, 'out_fmt': 'wallet', diff --git a/mmgen/main_tool.py b/mmgen/main_tool.py index 355d0bb0..7f67f316 100755 --- a/mmgen/main_tool.py +++ b/mmgen/main_tool.py @@ -373,7 +373,7 @@ if gc.prog_name == 'mmgen-tool': die(1,f'{cmd!r}: no such command') cfg = Config( - opts_data, + opts_data = opts_data, parsed_opts = po, need_proto = cls.need_proto, init_opts = {'rpc_backend':'aiohttp'} if cmd == 'twimport' else None, diff --git a/mmgen/opts.py b/mmgen/opts.py index 2a62344e..f821c804 100755 --- a/mmgen/opts.py +++ b/mmgen/opts.py @@ -17,7 +17,7 @@ # along with this program. If not, see . """ -opts: MMGen-specific options processing after generic processing by share.Opts +opts: MMGen-specific command-line options processing after generic processing by share.Opts """ import sys,os diff --git a/mmgen/proto/eth/params.py b/mmgen/proto/eth/params.py index fe975f0c..6fdbea63 100755 --- a/mmgen/proto/eth/params.py +++ b/mmgen/proto/eth/params.py @@ -47,6 +47,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Secp256k1): 62: 'morden', # ethereum classic testnet 17: 'developmentchain', # parity dev chain 1337: 'developmentchain', # geth dev chain + 711: 'ethereum', # geth mainnet (empty chain) } @property diff --git a/mmgen/proto/eth/rpc.py b/mmgen/proto/eth/rpc.py index 84e89269..df8daa84 100755 --- a/mmgen/proto/eth/rpc.py +++ b/mmgen/proto/eth/rpc.py @@ -16,18 +16,18 @@ import re from ...base_obj import AsyncInit from ...obj import Int -from ...util import die,oneshot_warning_group +from ...util import die,fmt,oneshot_warning_group from ...rpc import RPCClient class daemon_warning(oneshot_warning_group): class geth: color = 'yellow' - message = 'Geth has not been tested on mainnet. You may experience problems.' + message = 'Geth has not been tested on mainnet. You may experience problems.' class erigon: color = 'red' - message = 'Erigon support is EXPERIMENTAL. Use at your own risk!!!' + message = 'Erigon support is EXPERIMENTAL. Use at your own risk!!!' class CallSigs: pass diff --git a/test/unit_tests.py b/test/unit_tests.py index d5c29876..1e6b328b 100755 --- a/test/unit_tests.py +++ b/test/unit_tests.py @@ -91,7 +91,7 @@ class UnitTestHelpers(object): exc_w = max(len(e[1]) for e in data) m_exc = '{!r}: incorrect exception type (expected {!r})' m_err = '{!r}: incorrect error msg (should match {!r}' - m_noraise = "\nillegal action 'bad {}' failed to raise exception {!r}" + m_noraise = "\nillegal action 'bad {}' failed to raise an exception (expected {!r})" for (desc,exc_chk,emsg_chk,func) in data: try: cfg._util.vmsg_r(' bad {:{w}}'.format( desc+':', w=desc_w+1 )) diff --git a/test/unit_tests_d/ut_flags.py b/test/unit_tests_d/ut_flags.py index 5f122616..7d1afe01 100755 --- a/test/unit_tests_d/ut_flags.py +++ b/test/unit_tests_d/ut_flags.py @@ -59,7 +59,7 @@ class unit_test(object): ('flag (1)', 'ClassFlagsError', 'unrecognized flag', bad1 ), ('opt (1)', 'ClassFlagsError', 'unrecognized opt', bad2 ), ('avail_opts (1)', 'ClassFlagsError', 'underscore', bad3 ), - ('avail_opts (1)', 'ClassFlagsError', 'reserved name', bad4 ), + ('avail_opts (2)', 'ClassFlagsError', 'reserved name', bad4 ), ('class invocation (1)', 'AssertionError', 'list or tuple', bad5 ), ('class invocation (2)', 'ClassFlagsError', 'unrecognized opt', bad6 ), ('flag (2)', 'ClassFlagsError', 'not set', bad7 ),