minor whitespace, cleanups

This commit is contained in:
The MMGen Project 2025-11-15 09:50:21 +00:00
commit 4a24d2153c
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 28 additions and 19 deletions

View file

@ -438,7 +438,7 @@ class Config(Lockable):
@property @property
def data_dir(self): def data_dir(self):
""" """
location of wallet and other data - same as data_dir_root for mainnet location of wallet and other data
""" """
if not hasattr(self, '_data_dir'): if not hasattr(self, '_data_dir'):
def make_path(): def make_path():
@ -554,10 +554,19 @@ class Config(Lockable):
self.coin = self.coin.upper() self.coin = self.coin.upper()
self.token = self.token.upper() if self.token else None self.token = self.token.upper() if self.token else None
if self.regtest or self.bob or self.alice or self.carol or gc.prog_name == f'{gc.proj_id}-regtest': if (
self.regtest or
self.bob or
self.alice or
self.carol or
gc.prog_name == f'{gc.proj_id}-regtest'):
if self.coin != 'XMR': if self.coin != 'XMR':
self.network = 'regtest' self.network = 'regtest'
self.test_user = 'bob' if self.bob else 'alice' if self.alice else 'carol' if self.carol else '' self.test_user = (
'bob' if self.bob else
'alice' if self.alice else
'carol' if self.carol else
'')
else: else:
self.network = 'testnet' if self.testnet else 'mainnet' self.network = 'testnet' if self.testnet else 'mainnet'

View file

@ -317,9 +317,9 @@ class UserOpts(Opts):
-- --skip-cfg-file Skip reading the configuration file -- --skip-cfg-file Skip reading the configuration file
-- --version Print version information and exit -- --version Print version information and exit
-- --usage Print usage information and exit -- --usage Print usage information and exit
b- --bob Specify user Bob in MMGen regtest mode x- --bob Specify user Bob in MMGen regtest or test mode
b- --alice Specify user Alice in MMGen regtest mode x- --alice Specify user Alice in MMGen regtest or test mode
b- --carol Specify user Carol in MMGen regtest mode x- --carol Specify user Carol in MMGen regtest or test mode
rr COIN-SPECIFIC OPTIONS: rr COIN-SPECIFIC OPTIONS:
rr For descriptions, refer to the non-prefixed versions of these options above rr For descriptions, refer to the non-prefixed versions of these options above
rr Prefixed options override their non-prefixed counterparts rr Prefixed options override their non-prefixed counterparts

View file

@ -86,7 +86,8 @@ class TwCtlWithStore(TwCtl, metaclass=AsyncInit):
cfg.data_dir_root, cfg.data_dir_root,
'altcoins', 'altcoins',
proto.coin.lower(), proto.coin.lower(),
('' if proto.network == 'mainnet' else proto.network)) / (cls.tw_subdir or '') ('' if proto.network == 'mainnet' else proto.network),
(cls.tw_subdir or ''))
def upgrade_wallet_maybe(self): def upgrade_wallet_maybe(self):
pass pass

View file

@ -39,11 +39,10 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
# xmrwallet attrs: # xmrwallet attrs:
tx_relay_user = 'miner' tx_relay_user = 'miner'
# user sid autosign shift kal_range add_coind_args # user sid autosign port_shift kal_range add_coind_args
user_data = ( user_data = (
('miner', '98831F3A', False, 130, '1', []), ('miner', '98831F3A', False, 130, '1', []),
('alice', 'FE3C6545', True, 150, '1-2', []), ('alice', 'FE3C6545', True, 150, '1-2', []))
)
# autosign attrs: # autosign attrs:
coins = ['xmr'] coins = ['xmr']
@ -179,7 +178,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
t = self.spawn( t = self.spawn(
'mmgen-xmrwallet', 'mmgen-xmrwallet',
self.extra_opts self.extra_opts
+ [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}'] + [f'--wallet-dir={data.udir}']
+ [f'--daemon=localhost:{data.md.rpc_port}']
+ (self.autosign_opts if autosign else []) + (self.autosign_opts if autosign else [])
+ ['dump'] + ['dump']
+ ([] if autosign else [get_file_with_ext(data.udir, 'akeys')])) + ([] if autosign else [get_file_with_ext(data.udir, 'akeys')]))
@ -312,7 +312,8 @@ class CmdTestXMRAutosign(CmdTestXMRWallet, CmdTestAutosignThreaded):
args = ( args = (
self.extra_opts self.extra_opts
+ self.autosign_opts + self.autosign_opts
+ [f'--wallet-dir={data.udir}', f'--daemon=localhost:{data.md.rpc_port}'] + [f'--wallet-dir={data.udir}']
+ [f'--daemon=localhost:{data.md.rpc_port}']
+ add_opts + add_opts
+ [op] + [op]
+ ([get_file_with_ext(self.asi.xmr_tx_dir, ext)] if ext else []) + ([get_file_with_ext(self.asi.xmr_tx_dir, ext)] if ext else [])

View file

@ -293,8 +293,8 @@ class CmdTestXMRWallet(CmdTestBase):
run(f'rm -f {glob}', shell=True) run(f'rm -f {glob}', shell=True)
t = self.spawn( t = self.spawn(
'mmgen-xmrwallet', 'mmgen-xmrwallet',
[f'--wallet-dir={data.udir}'] self.extra_opts
+ self.extra_opts + [f'--wallet-dir={data.udir}']
+ (self.autosign_opts if data.autosign else []) + (self.autosign_opts if data.autosign else [])
+ add_opts + add_opts
+ [op] + [op]
@ -412,13 +412,11 @@ class CmdTestXMRWallet(CmdTestBase):
data = self.users[user] data = self.users[user]
if data.autosign: if data.autosign:
self.insert_device_online() self.insert_device_online()
cmd_opts = list_gen(
[f'--wallet-dir={data.udir}'],
[f'--daemon=localhost:{data.md.rpc_port}'])
t = self.spawn( t = self.spawn(
'mmgen-xmrwallet', 'mmgen-xmrwallet',
self.extra_opts self.extra_opts
+ cmd_opts + [f'--wallet-dir={data.udir}']
+ [f'--daemon=localhost:{data.md.rpc_port}']
+ (self.autosign_opts if data.autosign else []) + (self.autosign_opts if data.autosign else [])
+ add_opts + add_opts
+ [op] + [op]
@ -459,7 +457,6 @@ class CmdTestXMRWallet(CmdTestBase):
data = self.users[user] data = self.users[user]
cmd_opts = list_gen( cmd_opts = list_gen(
[f'--wallet-dir={data.udir}'],
[f'--outdir={data.udir}', not data.autosign], [f'--outdir={data.udir}', not data.autosign],
[f'--daemon=localhost:{data.md.rpc_port}'], [f'--daemon=localhost:{data.md.rpc_port}'],
[f'--tx-relay-daemon={tx_relay_parm}', tx_relay_parm], [f'--tx-relay-daemon={tx_relay_parm}', tx_relay_parm],
@ -469,6 +466,7 @@ class CmdTestXMRWallet(CmdTestBase):
t = self.spawn( t = self.spawn(
'mmgen-xmrwallet', 'mmgen-xmrwallet',
self.extra_opts self.extra_opts
+ [f'--wallet-dir={data.udir}']
+ cmd_opts + cmd_opts
+ add_opts + add_opts
+ (self.autosign_opts if data.autosign else []) + (self.autosign_opts if data.autosign else [])