mmgen-xmrwallet: ignore already imported wallet outputs files

This commit is contained in:
The MMGen Project 2024-04-05 16:00:34 +00:00
commit 80f6f9aa5c
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 18 additions and 7 deletions

View file

@ -270,6 +270,17 @@ class Signable:
clean_all = True
summary_footer = '\n'
@property
def unsigned(self):
import json
unsigned = super().unsigned
def gen():
for f in unsigned:
with open(f) as fh:
if not json.load(fh)['MoneroMMGenWalletOutputsFile']['data']['imported']:
yield f
return tuple(gen())
async def sign(self,f):
from .xmrwallet import MoneroWalletOps,xmrwallet_uargs
wallet_idx = MoneroWalletOps.wallet.get_idx_from_fn(f)
@ -281,11 +292,8 @@ class Signable:
spec = None ),
)
obj = await m.main(f, wallet_idx, restart_daemon=self.need_daemon_restart(m,wallet_idx))
if obj.data.sign:
obj.write()
self.action_desc = 'imported and signed'
else:
self.action_desc = 'imported'
obj.write()
self.action_desc = 'imported and signed' if obj.data.sign else 'imported'
return obj
class message(base):

View file

@ -1 +1 @@
March 2024
April 2024

View file

@ -1 +1 @@
14.1.dev25
14.1.dev26

View file

@ -500,6 +500,7 @@ class MoneroWalletOutputsFile:
'outputs_data_hex',
'signed_key_images',
'sign',
'imported',
])
def __init__(self,cfg):
@ -1964,6 +1965,8 @@ class MoneroWalletOps:
data = data)
idata = m.data.signed_key_images or []
bmsg(f' {len(idata)} key image{suf(idata)} signed')
else:
m.data = m.data._replace(imported=True)
return m
class import_key_images(wallet):