mmgen-xmrwallet: new --wallet-dir opt, replacing --outdir

This commit is contained in:
The MMGen Project 2021-07-03 12:53:46 +00:00
commit f879e700e1
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 12 additions and 9 deletions

View file

@ -39,8 +39,6 @@ opts_data = {
--, --longhelp Print help message for long options (common
options)
-b, --rescan-blockchain Rescan the blockchain if wallet fails to sync
-d, --outdir=D Output or operate on wallets in directory 'D'
instead of working dir
-D, --daemon=H:P Connect to monerod at {D}
-R, --tx-relay-daemon=H:P[:H:P] Relay transactions via monerod specified by
{R}
@ -50,6 +48,8 @@ opts_data = {
-r, --restore-height=H Scan from height 'H' when creating wallets
-s, --no-start-wallet-daemon Dont start the wallet daemon at startup
-S, --no-stop-wallet-daemon Dont stop the wallet daemon at exit
-w, --wallet-dir=D Output or operate on wallets in directory 'D'
instead of working directory
""",
'notes': """
@ -160,6 +160,7 @@ uo = namedtuple('uopts',[
'rescan_blockchain',
'no_start_wallet_daemon',
'no_stop_wallet_daemon',
'wallet_dir',
])
uargs = ua( op, infile, wallets, spec )
@ -170,6 +171,7 @@ uopts = uo(
opt.rescan_blockchain,
opt.no_start_wallet_daemon,
opt.no_stop_wallet_daemon,
opt.wallet_dir,
)
m = getattr(MoneroWalletOps,op)(uargs,uopts)

View file

@ -150,7 +150,7 @@ class MoneroWalletOps:
ops = ('create','sync','transfer','sweep')
opts = (
'outdir',
'wallet_dir',
'daemon',
'tx_relay_daemon',
'use_internal_keccak_module',
@ -163,7 +163,7 @@ class MoneroWalletOps:
class base(MMGenObject):
opts = ('outdir',)
opts = ('wallet_dir',)
def __init__(self,uarg_tuple,uopt_tuple):
@ -264,7 +264,7 @@ class MoneroWalletOps:
check_wallets()
self.wd = MoneroWalletDaemon(
wallet_dir = opt.outdir or '.',
wallet_dir = uopt.wallet_dir or '.',
test_suite = g.test_suite,
daemon_addr = uopt.daemon or None,
testnet = g.testnet,
@ -297,7 +297,7 @@ class MoneroWalletOps:
def get_wallet_fn(self,d):
return os.path.join(
opt.outdir or '.','{}-{}-MoneroWallet{}{}'.format(
uopt.wallet_dir or '.','{}-{}-MoneroWallet{}{}'.format(
self.kal.al_id.sid,
d.idx,
'.testnet' if g.testnet else '',
@ -654,7 +654,7 @@ class MoneroWalletOps:
m = re.fullmatch(uarg_info['tx_relay_daemon'].pat,uopt.tx_relay_daemon,re.ASCII)
self.wd2 = MoneroWalletDaemon(
wallet_dir = opt.outdir or '.',
wallet_dir = uopt.wallet_dir or '.',
test_suite = g.test_suite,
daemon_addr = m[1],
proxy = m[2],

View file

@ -285,7 +285,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
assert wallet is None or is_int(wallet), 'wallet arg'
data = self.users[user]
run('rm -f {}*'.format( data.walletfile_fs.format(wallet or '*') ),shell=True)
dir_opt = [f'--outdir={data.udir}']
dir_opt = [f'--wallet-dir={data.udir}']
t = self.spawn(
'mmgen-xmrwallet',
self.long_opts + dir_opt + [ 'create', data.kafile, (wallet or data.kal_range) ] )
@ -321,7 +321,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
def sync_wallets(self,user,wallets=None,add_opts=None):
data = self.users[user]
cmd_opts = list_gen(
[f'--outdir={data.udir}'],
[f'--wallet-dir={data.udir}'],
[f'--daemon=localhost:{data.md.rpc_port}'],
)
t = self.spawn(
@ -350,6 +350,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
data = self.users[user]
cmd_opts = list_gen(
[f'--wallet-dir={data.udir}'],
[f'--outdir={data.udir}'],
[f'--daemon=localhost:{data.md.rpc_port}'],
[f'--tx-relay-daemon={tx_relay_parm}', tx_relay_parm]