XMR compat: allow sweep transaction to empty account (bugfix)

This commit is contained in:
The MMGen Project 2026-02-02 09:56:58 +00:00
commit 80d122a1d8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 11 additions and 4 deletions

View file

@ -20,7 +20,6 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
hdr_lbl = 'spendable accounts'
desc = 'spendable accounts'
include_empty = False
async def __init__(self, cfg, proto, *, minconf=1, addrs=[], tx=None):
self.prompt_fs_in = [
@ -38,6 +37,7 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
's': 'i_addr_sweep',
'S': 'i_acct_sweep'})
await super().__init__(cfg, proto, minconf=minconf, addrs=addrs, tx=tx)
self.is_sweep = self.include_empty = self.tx and self.tx.is_sweep
async def get_idx_from_user(self, method_name):
if method_name in ('i_acct_sweep', 'i_addr_sweep'):

View file

@ -29,6 +29,7 @@ class MoneroTwView:
item_desc = 'account'
nice_addr_w = {'addr': 20}
total = None
is_sweep = False
sort_disp = {
'addr': 'Addr',
@ -195,8 +196,14 @@ class MoneroTwView:
color = color,
color_override = None if d.total == d.unlocked_total else 'orange'
)) + rfill
for v in d.data.values():
yield fmt_method(None, v.data, cw, fs, color, yes, no)
if self.is_sweep:
if d.total:
for v in d.data.values():
if v.data.amt:
yield fmt_method(None, v.data, cw, fs, color, yes, no)
else:
for v in d.data.values():
yield fmt_method(None, v.data, cw, fs, color, yes, no)
def squeezed_format_line(self, n, d, cw, fs, color, yes, no):
return fs.format(

View file

@ -791,7 +791,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
return self._alice_txops('txcreate', menu='S', sweep_menu='23', sweep_type='sweep')
def alice_txcreate_sweep2(self):
return self._alice_txops('txcreate', menu='s', sweep_menu='2', sweep_type='sweep_all')
return self._alice_txops('txcreate', menu='s', sweep_menu='3', sweep_type='sweep_all')
alice_txcreate3 = alice_txcreate2 = alice_txcreate1