mmgen-autosign: add --wallet-dir opt; update test

This commit is contained in:
The MMGen Project 2023-04-18 18:35:56 +00:00
commit d757bb2949
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 10 additions and 2 deletions

View file

@ -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' )

View file

@ -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': """

View file

@ -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