From d757bb29494cba74bc5315bd42708b5d47a8439e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 18 Apr 2023 18:35:56 +0000 Subject: [PATCH] mmgen-autosign: add --wallet-dir opt; update test --- mmgen/autosign.py | 3 ++- mmgen/main_autosign.py | 1 + test/test_py_d/ts_autosign.py | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mmgen/autosign.py b/mmgen/autosign.py index 871a0457..fd537682 100755 --- a/mmgen/autosign.py +++ b/mmgen/autosign.py @@ -27,7 +27,7 @@ class AutosignConfig(Config): class Autosign: dfl_mountpoint = os.path.join(os.sep,'mnt','mmgen_autosign') - wallet_dir = os.path.join(os.sep,'dev','shm','autosign') + dfl_wallet_dir = os.path.join(os.sep,'dev','shm','autosign') disk_label_dir = os.path.join(os.sep,'dev','disk','by-label') part_label = 'MMGEN_TX' @@ -62,6 +62,7 @@ class Autosign: self.cfg = cfg self.mountpoint = cfg.mountpoint or self.dfl_mountpoint + self.wallet_dir = cfg.wallet_dir or self.dfl_wallet_dir self.tx_dir = os.path.join( self.mountpoint, 'tx' ) self.msg_dir = os.path.join( self.mountpoint, 'msg' ) diff --git a/mmgen/main_autosign.py b/mmgen/main_autosign.py index d9d221fd..1814399c 100755 --- a/mmgen/main_autosign.py +++ b/mmgen/main_autosign.py @@ -49,6 +49,7 @@ opts_data = { will not be printed. -q, --quiet Produce quieter output -v, --verbose Produce more verbose output +-w, --wallet-dir=D Specify an alternate wallet dir (default: {asi.dfl_wallet_dir!r}) """, 'notes': """ diff --git a/test/test_py_d/ts_autosign.py b/test/test_py_d/ts_autosign.py index 854032b5..857d256f 100755 --- a/test/test_py_d/ts_autosign.py +++ b/test/test_py_d/ts_autosign.py @@ -92,12 +92,16 @@ class TestSuiteAutosignBase(TestSuiteBase): self.network_ids = [c+'_tn' for c in self.daemon_coins] + self.daemon_coins + if not self.live: + self.wallet_dir = os.path.join(self.tmpdir,'dev.shm.autosign') + self.asi = Autosign( AutosignConfig({ 'mountpoint': ( None if self.live else os.path.join(self.tmpdir,self.mountpoint_basename) - ) + ), + 'wallet_dir': None if self.live else self.wallet_dir, }) ) self.mountpoint = self.asi.mountpoint @@ -116,9 +120,11 @@ class TestSuiteAutosignBase(TestSuiteBase): init_led(self.simulate) else: os.makedirs(self.asi.tx_dir,exist_ok=True) # creates mountpoint + os.makedirs(self.wallet_dir,exist_ok=True) self.opts.extend([ '--mountpoint=' + self.mountpoint, '--no-insert-check', + '--wallet-dir=' + self.wallet_dir, ]) self.tx_file_ops('set_count') # initialize tx_count here so we can resume anywhere