xmrwallet: delay mounting of removable device

This commit is contained in:
The MMGen Project 2024-02-10 15:10:45 +00:00
commit 1f75be898d
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 25 additions and 15 deletions

View file

@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9","3.10","3.11"]
python-version: ["3.10","3.11"]
steps:
- uses: actions/checkout@v4

View file

@ -1 +1 @@
January 2024
February 2024

View file

@ -1 +1 @@
14.1.dev7
14.1.dev8

View file

@ -145,16 +145,6 @@ else:
op_cls = getattr(MoneroWalletOps,op.replace('-','_'))
if cfg.autosign and not cfg.test_suite:
from .autosign import get_autosign_obj
asi = get_autosign_obj(cfg,'xmr')
if not asi.get_insert_status():
die(1,'Removable device not present!')
if op_cls.do_umount:
import atexit
atexit.register(lambda: asi.do_umount())
asi.do_mount()
m = op_cls(cfg, xmrwallet_uargs(infile, wallets, spec))
if async_run(m.main()):

View file

@ -731,6 +731,21 @@ class MoneroWalletOps:
async def stop_wallet_daemon(self):
pass
def post_mount_action(self):
pass
def mount_removable_device(self):
if self.cfg.autosign and not self.cfg.test_suite:
from .autosign import get_autosign_obj
asi = get_autosign_obj(self.cfg,'xmr')
if not asi.get_insert_status():
die(1,'Removable device not present!')
if self.do_umount:
import atexit
atexit.register(lambda: asi.do_umount())
asi.do_mount()
self.post_mount_action()
class wallet(base):
opts = (
@ -806,6 +821,7 @@ class MoneroWalletOps:
addr_idxs = uarg.wallets,
skip_chksum_msg = True )
else:
self.mount_removable_device()
# with watch_only, make a second attempt to open the file as KeyAddrList:
for first_try in (True,False):
try:
@ -1687,7 +1703,7 @@ class MoneroWalletOps:
action = 'submitting transaction with'
opts = ('tx_relay_daemon',)
def check_uopts(self):
def post_mount_action(self):
self.tx # trigger an exit if no suitable transaction present
def die_no_tx(self,desc,num_txs,tx_dir):
@ -1905,6 +1921,8 @@ class MoneroWalletOps:
super().__init__(cfg,uarg_tuple)
self.mount_removable_device()
self.tx = MoneroMMGenTX.Signed( self.cfg, Path(uarg.infile) )
if self.cfg.tx_relay_daemon:
@ -1960,6 +1978,9 @@ class MoneroWalletOps:
do_umount = False
async def main(self,cols=None):
self.mount_removable_device()
if self.cfg.autosign:
asi = get_autosign_obj(self.cfg,'xmr')
files = [f for f in asi.xmr_tx_dir.iterdir() if f.name.endswith('.'+MoneroMMGenTX.Submitted.ext)]

View file

@ -12,7 +12,6 @@ indent-after-paren = 2
max-line-length = 110
[tool.pylint.main]
py-version = "3.7"
recursive = true
jobs = 0
ignore = [