From f879e700e1c9cb2c79f5f819077f4df80d8eea9d Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 3 Jul 2021 12:53:46 +0000 Subject: [PATCH] mmgen-xmrwallet: new --wallet-dir opt, replacing --outdir --- mmgen/main_xmrwallet.py | 6 ++++-- mmgen/xmrwallet.py | 10 +++++----- test/test_py_d/ts_xmrwallet.py | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mmgen/main_xmrwallet.py b/mmgen/main_xmrwallet.py index 098c250c..a0025050 100755 --- a/mmgen/main_xmrwallet.py +++ b/mmgen/main_xmrwallet.py @@ -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 Don’t start the wallet daemon at startup -S, --no-stop-wallet-daemon Don’t 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) diff --git a/mmgen/xmrwallet.py b/mmgen/xmrwallet.py index 86f73db2..a83dcc8b 100755 --- a/mmgen/xmrwallet.py +++ b/mmgen/xmrwallet.py @@ -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], diff --git a/test/test_py_d/ts_xmrwallet.py b/test/test_py_d/ts_xmrwallet.py index 92380fbe..fb84dbc8 100755 --- a/test/test_py_d/ts_xmrwallet.py +++ b/test/test_py_d/ts_xmrwallet.py @@ -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]