From a83dbb0ad5dd328973a66ea3ceef6e7979562345 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 29 Jan 2022 11:23:39 +0000 Subject: [PATCH] minor fixes and cleanups --- README.md | 6 +++--- mmgen/addrlist.py | 3 +-- mmgen/term.py | 6 +++++- mmgen/tool/coin.py | 5 +++-- mmgen/tx.py | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3eff2af1..6d51c5e6 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ using standard command-line utilities. MMGen also differs from most cryptocurrency wallets today in its use of the original 1626-word [Electrum wordlist][ew] for mnemonic seed phrases. Seed phrases are derived using ordinary base conversion, similarly allowing you to -regenerate your seed from your seed phrase without MMGen program itself, should +regenerate your seed from your seed phrase without MMGen program itself should the need arise. An example of how to do this at the Python prompt is provided [here.][S] @@ -70,7 +70,7 @@ widespread standard. [Litecoin][bx], [Ethereum][E], Ethereum Classic and [ERC20 tokens][E]. - **Monero transacting and wallet management** via the interactive [`mmgen-xmrwallet`][xm] command. Offline transaction signing is possible - using a shared blockchain between online and offline machines. + using a blockchain shared between online and offline machines. - **[Address generation support][ag]** for the above coins, plus [Zcash][zx] (t and z addresses) and [144 Bitcoin-derived altcoins][ax]. - **Support for all Bitcoin address types** including Segwit-P2SH and Bech32. @@ -117,7 +117,7 @@ widespread standard. from your seed phrase at the prompt, allowing you to dispense with a physically stored wallet entirely if you wish. - Word-completing **mnemonic entry modes** customized for each of MMGen’s - supported wordlists minimize keystrokes during seed phrase entry. + supported wordlists minimize keystrokes required during seed phrase entry. - **Stealth mnemonic entry:** This feature allows you to obfuscate your seed phrase with “dead” keystrokes to guard against acoustic side-channel attacks. - **Network privacy:** MMGen never “calls home” or checks for upgrades over the diff --git a/mmgen/addrlist.py b/mmgen/addrlist.py index cac3d04a..ea64c880 100755 --- a/mmgen/addrlist.py +++ b/mmgen/addrlist.py @@ -20,11 +20,9 @@ addrlist.py: Address list classes for the MMGen suite """ -from hashlib import sha256,sha512 from .util import qmsg,qmsg_r,suf,make_chksum_N,Msg from .objmethods import MMGenObject,Hilite,InitErrors from .obj import MMGenListItem,ListItemAttr,MMGenDict,WalletPassword -from .seed import SeedID from .key import PrivKey from .addr import MMGenID,MMGenAddrType,CoinAddr,AddrIdx,AddrListID,ViewKey @@ -234,6 +232,7 @@ class AddrList(MMGenObject): # Address info for a single seed ID le = self.entry_type num,pos = (0,0) + from hashlib import sha256,sha512 from .globalvars import g while pos != t_addrs: diff --git a/mmgen/term.py b/mmgen/term.py index 320f5715..52555bb7 100755 --- a/mmgen/term.py +++ b/mmgen/term.py @@ -124,7 +124,7 @@ class MMGenTermLinuxStub(MMGenTermLinux): @classmethod def init(cls): - pass + cls.stdin_fd = sys.stdin.fileno() @classmethod def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_chars=None,sleep=None): @@ -135,6 +135,10 @@ class MMGenTermLinuxStub(MMGenTermLinux): get_char_raw = get_char + @classmethod + def kb_hold_protect(cls): + pass + class MMGenTermMSWin(MMGenTerm): @classmethod diff --git a/mmgen/tool/coin.py b/mmgen/tool/coin.py index 0e05a4ae..1a3c4e79 100755 --- a/mmgen/tool/coin.py +++ b/mmgen/tool/coin.py @@ -25,9 +25,8 @@ generator_data = namedtuple('generator_data',['kg','ag']) from .common import tool_cmd_base -from ..protocol import init_proto,init_genonly_altcoins,hash160 from ..key import PrivKey -from ..addr import KeyGenerator,AddrGenerator,MMGenAddrType,CoinAddr +from ..addr import KeyGenerator,AddrGenerator,CoinAddr class tool_cmd(tool_cmd_base): """ @@ -134,6 +133,7 @@ class tool_cmd(tool_cmd_base): if self.mmtype.name == 'segwit': return self.proto.pubkey2segwitaddr( pubkey ) else: + from ..protocol import hash160 return self.pubhash2addr( hash160(pubkey).hex() ) def pubhex2redeem_script(self,pubkeyhex:'sstr'): # new @@ -146,6 +146,7 @@ class tool_cmd(tool_cmd_base): assert self.mmtype.name == 'segwit', 'This command is meaningful only for --type=segwit' assert redeem_scripthex[:4] == '0014', f'{redeem_scripthex!r}: invalid redeem script' assert len(redeem_scripthex) == 44, f'{len(redeem_scripthex)//2} bytes: invalid redeem script length' + from ..protocol import hash160 return self.pubhash2addr( hash160(bytes.fromhex(redeem_scripthex)).hex() ) def pubhash2addr(self,pubhashhex:'sstr'): diff --git a/mmgen/tx.py b/mmgen/tx.py index 5ca53044..56cd0df0 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -634,7 +634,7 @@ class MMGenTX: from decimal import Decimal tx_size = self.estimate_size() ret = self.proto.coin_amt( - Decimal(fee_per_kb * opt.tx_fee_adj * tx_size / 1024), + fee_per_kb * Decimal(opt.tx_fee_adj) * tx_size / 1024, from_decimal = True ) if opt.verbose: msg(fmt(f"""