From b4fd9e60caf09020feb10e837a7e80a9ffb3fe4b Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 15 Nov 2026 10:56:44 +0000 Subject: [PATCH] whitespace, minor cleanups --- mmgen/autosign/signable.py | 23 +++++++++++++++-------- mmgen/proto/xmr/tw/view.py | 6 ++---- mmgen/tw/view.py | 6 +++--- mmgen/xmrwallet/ops/dump.py | 2 ++ mmgen/xmrwallet/ops/sign.py | 7 ++++--- mmgen/xmrwallet/ops/wallet.py | 13 +++++++------ 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/mmgen/autosign/signable.py b/mmgen/autosign/signable.py index fb8c210c..15984600 100644 --- a/mmgen/autosign/signable.py +++ b/mmgen/autosign/signable.py @@ -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: diff --git a/mmgen/proto/xmr/tw/view.py b/mmgen/proto/xmr/tw/view.py index 1e8404a9..03c30d70 100644 --- a/mmgen/proto/xmr/tw/view.py +++ b/mmgen/proto/xmr/tw/view.py @@ -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 diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 530067f6..fa9cf23d 100644 --- a/mmgen/tw/view.py +++ b/mmgen/tw/view.py @@ -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: diff --git a/mmgen/xmrwallet/ops/dump.py b/mmgen/xmrwallet/ops/dump.py index 7eece1f3..a99d34c2 100644 --- a/mmgen/xmrwallet/ops/dump.py +++ b/mmgen/xmrwallet/ops/dump.py @@ -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, diff --git a/mmgen/xmrwallet/ops/sign.py b/mmgen/xmrwallet/ops/sign.py index 1a9d87b1..6f9b711c 100644 --- a/mmgen/xmrwallet/ops/sign.py +++ b/mmgen/xmrwallet/ops/sign.py @@ -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): diff --git a/mmgen/xmrwallet/ops/wallet.py b/mmgen/xmrwallet/ops/wallet.py index ff2c4879..cfc5d255 100644 --- a/mmgen/xmrwallet/ops/wallet.py +++ b/mmgen/xmrwallet/ops/wallet.py @@ -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)