whitespace, minor cleanups

This commit is contained in:
The MMGen Project 2026-11-15 10:56:44 +00:00
commit b4fd9e60ca
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 33 additions and 24 deletions

View file

@ -15,7 +15,7 @@ import sys
from ..cfg import Config
from ..tx import UnsignedTX, SignedTX
from ..util import msg, msg_r, gmsg, bmsg, die, suf, fmt_list
from ..color import yellow, red, orange
from ..color import red, orange
class Signable:
@ -111,19 +111,26 @@ class Signable:
if body:
bmsg('\nAutosign summary:')
fs = '{} {} {}'
t_wid, a_wid = 6, 44
fs = '{t} {a} {A}'
t_wid, a_wid, A_wid = (6, 44, 7)
def gen():
yield fs.format('TX ID ', 'Non-MMGen outputs'+' '*(a_wid-17), 'Amount')
yield fs.format('-'*t_wid, '-'*a_wid, '-'*7)
yield fs.format(
t = 'TX ID'.ljust(t_wid),
a = 'Non-MMGen outputs'.ljust(a_wid),
A = 'Amount')
yield fs.format(
t = '-' * t_wid,
a = '-' * a_wid,
A = '-' * A_wid)
for tx, non_mmgen in body:
for nm in non_mmgen:
yield fs.format(
tx.txid.fmt(t_wid, color=True) if nm is non_mmgen[0] else ' '*t_wid,
nm.addr.fmt(nm.addr.view_pref, a_wid, color=True)
t = tx.txid.fmt(t_wid, color=True)
if nm is non_mmgen[0] else ''.ljust(t_wid),
a = nm.addr.fmt(nm.addr.view_pref, a_wid, color=True)
if nm.addr else '-'.ljust(a_wid),
nm.amt.hl() + ' ' + yellow(tx.coin))
A = nm.amt.hl() + ' ' + yellow(tx.coin))
msg('\n' + '\n'.join(gen()))
else:

View file

@ -13,7 +13,8 @@ proto.xmr.tw.view: Monero protocol base class for tracking wallet view classes
import asyncio
from collections import namedtuple
from ....obj import ImmutableAttr
from ....obj import ImmutableAttr, Int
from ....util import msg, ymsg, suf
from ....color import red, green
from ....addr import MoneroIdx
from ....amt import CoinAmtChk
@ -251,8 +252,6 @@ class MoneroTwView:
return MMGenID(proto=self.proto, id_str='{}:M:{}'.format(self.sid, wnum))
def choose_wallet(self, prompt):
from ....obj import Int
from ....util import msg, suf
from ....ui import item_chooser
wdata = {}
for d in self.accts_data:
@ -271,7 +270,6 @@ class MoneroTwView:
class action(TwView.action):
async def a_sync_wallets(self, parent):
from ....util import msg, ymsg
msg('')
await parent.get_data(refresh=True)
del parent._rpc

View file

@ -463,9 +463,9 @@ class TwView(MMGenObject, metaclass=AsyncInit):
if hasattr(self.rpc, 'daemon') else ''))
if hasattr(self.rpc, 'blockcount'):
yield 'Block {} [{}]'.format(
self.rpc.blockcount.hl(color=color),
make_timestr(self.rpc.cur_date))
yield 'Block {a}{b}'.format(
a = self.rpc.blockcount.hl(color=color),
b = ' [{}]'.format(make_timestr(self.rpc.cur_date)) if self.rpc.cur_date else '')
if hasattr(self, 'total'):
if hasattr(self, 'unlocked_total') and self.total != self.unlocked_total:

View file

@ -37,8 +37,10 @@ class OpDumpDataCommon(OpWallet):
return_data = True
async def process_wallet(self, d, fn, last):
h = MoneroWalletRPC(self, d)
h.open_wallet('source', refresh=not self.wallet_offline)
return {
'seed_id': self.kal.al_id.sid,
'wallet_num': d.idx,

View file

@ -54,9 +54,10 @@ class OpSign(OpWallet):
- check that input amount is equal to sum of send amount, change amount and fee
Actions performed by the user:
- For transfers, observe output of the offline signing operation and check correctness
of destination address and amount. The offline installation cannot know how much the
user intended to send and to what address.
- for all transactions, check signing summary for correctness of transaction type
- for transfers, check signing summary for correctness of destination address and
amount - the offline installation cannot know how much the user intended to send
and to what address
"""
def do_err(msg):

View file

@ -62,13 +62,14 @@ class OpWallet(OpBase):
self.wallet_offline = True
self.wd = MoneroWalletDaemon(
cfg = self.cfg,
proto = self.proto,
monerod_addr = self.cfg.daemon or None,
cfg = self.cfg,
proto = self.proto,
test_user = self.cfg.test_user,
monerod_addr = self.cfg.daemon or None,
disable_authentication = self.disable_authentication,
offline = self.wallet_offline,
trust_monerod = self.trust_monerod,
test_monerod = not self.wallet_offline)
offline = self.wallet_offline,
trust_monerod = self.trust_monerod,
test_monerod = not self.wallet_offline)
if self.is_create and self.cfg.compat:
self.wd.wallet_dir.mkdir(parents=True, exist_ok=True)