minor cleanups

This commit is contained in:
The MMGen Project 2025-03-29 09:30:15 +00:00
commit 819202b584
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
9 changed files with 18 additions and 14 deletions

View file

@ -18,7 +18,7 @@
"""
mmgen-txbump: Create, and optionally send and sign, a replacement transaction
on networks that support replace-by-fee (RBF)
on supporting networks
"""
from .cfg import gc, Config
@ -31,7 +31,7 @@ opts_data = {
'text': {
'desc': """
Create, and optionally send and sign, a replacement transaction
on networks that support replace-by-fee (RBF)
on supporting networks
""",
'usage2': (
f'[opts] [{gc.proj_name} TX file] [seed source] ...',

View file

@ -13,7 +13,7 @@ proto.eth.tx.status: Ethereum transaction status class
"""
from ....tx import status as TxBase
from ....util import msg, Msg, die, suf, capfirst, pp_fmt
from ....util import msg, Msg, die, suf, capfirst
class Status(TxBase.Status):

View file

@ -692,6 +692,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
fee_info_data = ('0.00105', '50'),
no_read = False,
print_listing = True,
bad_input_sels = True,
tweaks = []):
fee_info_pat = r'\D{}\D.*{c} .*\D{}\D.*gas price in Gwei'.format(*fee_info_data, c=self.proto.coin)
t = self.spawn(f'mmgen-{caller}', self.eth_args + ['-B'] + args)
@ -705,7 +706,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
input_sels_prompt = 'to spend from',
inputs = acct,
file_desc = 'transaction',
bad_input_sels = True,
bad_input_sels = bad_input_sels,
interactive_fee = interactive_fee,
fee_info_pat = fee_info_pat,
fee_desc = 'transaction fee or gas price',

View file

@ -17,10 +17,9 @@ from mmgen.cfg import Config
from mmgen.protocol import init_proto
from .include.runner import CmdTestRunner
from .include.common import dfl_words_file, dfl_seed_id, rt_pw
from .httpd.thornode import ThornodeServer
from .regtest import CmdTestRegtest
from .swap import CmdTestSwapMethods
from .ethdev import CmdTestEthdev

View file

@ -94,12 +94,14 @@ def confirm_continue():
def randbool():
return getrand(1).hex()[0] in '02468ace'
def get_env_without_debug_vars():
def cleanup_env(cfg):
ret = dict(os.environ)
if cfg.debug_utf8:
return ret
for k in cfg._env_opts:
if k[:11] == 'MMGEN_DEBUG' and k in ret:
del ret[k]
return ret
return ret | {'EXEC_WRAPPER_DO_RUNTIME_MSG': ''}
def get_file_with_ext(
tdir,

View file

@ -134,6 +134,7 @@ class CmdTestRunner:
no_passthru_opts = False,
spawn_env_override = None,
exit_val = None,
silent = False,
env = {}):
self.exit_val = exit_val
@ -218,6 +219,7 @@ class CmdTestRunner:
pexpect_spawn = pexpect_spawn,
timeout = timeout,
send_delay = send_delay,
silent = silent,
direct_exec = direct_exec)
def end_msg(self):

View file

@ -40,7 +40,7 @@ from .include.common import (
pwfile,
ref_bw_file_spc,
ref_enc_fn,
get_env_without_debug_vars,
cleanup_env,
tool_enc_passwd,
skip
)
@ -340,7 +340,7 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
t = self.spawn(
'mmgen-tool',
['-q', 'decrypt', f, 'outfile='+dec_file, 'hash_preset=1'],
env = os.environ if self.cfg.debug_utf8 else get_env_without_debug_vars())
env = cleanup_env(self.cfg))
t.passphrase('data', tool_enc_passwd)
t.written_to_file('Decrypted data')
dec_txt = read_from_file(dec_file)

View file

@ -53,7 +53,7 @@ from .include.common import (
tw_comment_lat_cyr_gr,
tw_comment_zh,
tx_comment_jp,
get_env_without_debug_vars,
cleanup_env,
rt_pw)
from .base import CmdTestBase
@ -1237,8 +1237,7 @@ class CmdTestRegtest(CmdTestBase, CmdTestShared):
ret = self.spawn(
'mmgen-regtest',
cmd_args,
env = (os.environ if self.cfg.debug_utf8 else get_env_without_debug_vars()) | (
{'EXEC_WRAPPER_DO_RUNTIME_MSG': ''}),
env = cleanup_env(self.cfg),
no_msg = True
).read().strip()
return json.loads(ret) if decode_json else ret

View file

@ -47,6 +47,7 @@ class MMGenPexpect:
pexpect_spawn = False,
send_delay = None,
timeout = None,
silent = False,
direct_exec = False):
self.pexpect_spawn = pexpect_spawn
@ -67,7 +68,7 @@ class MMGenPexpect:
else:
self.p = PopenSpawn(args, encoding='utf8', timeout=timeout, env=spawn_env)
if cfg.exact_output:
if cfg.exact_output and not silent:
self.p.logfile = sys.stdout
def do_decrypt_ka_data(