Browse Source

minor fixes and cleanups

The MMGen Project 3 years ago
parent
commit
a83dbb0ad5
5 changed files with 13 additions and 9 deletions
  1. 3 3
      README.md
  2. 1 2
      mmgen/addrlist.py
  3. 5 1
      mmgen/term.py
  4. 3 2
      mmgen/tool/coin.py
  5. 1 1
      mmgen/tx.py

+ 3 - 3
README.md

@@ -51,7 +51,7 @@ using standard command-line utilities.
 MMGen also differs from most cryptocurrency wallets today in its use of the
 MMGen also differs from most cryptocurrency wallets today in its use of the
 original 1626-word [Electrum wordlist][ew] for mnemonic seed phrases.  Seed
 original 1626-word [Electrum wordlist][ew] for mnemonic seed phrases.  Seed
 phrases are derived using ordinary base conversion, similarly allowing you to
 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
 the need arise.  An example of how to do this at the Python prompt is provided
 [here.][S]
 [here.][S]
 
 
@@ -70,7 +70,7 @@ widespread standard.
   [Litecoin][bx], [Ethereum][E], Ethereum Classic and [ERC20 tokens][E].
   [Litecoin][bx], [Ethereum][E], Ethereum Classic and [ERC20 tokens][E].
 - **Monero transacting and wallet management** via the interactive
 - **Monero transacting and wallet management** via the interactive
   [`mmgen-xmrwallet`][xm] command.  Offline transaction signing is possible
   [`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]
 - **[Address generation support][ag]** for the above coins, plus [Zcash][zx]
   (t and z addresses) and [144 Bitcoin-derived altcoins][ax].
   (t and z addresses) and [144 Bitcoin-derived altcoins][ax].
 - **Support for all Bitcoin address types** including Segwit-P2SH and Bech32.
 - **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
   from your seed phrase at the prompt, allowing you to dispense with a
   physically stored wallet entirely if you wish.
   physically stored wallet entirely if you wish.
 - Word-completing **mnemonic entry modes** customized for each of MMGen’s
 - 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
 - **Stealth mnemonic entry:** This feature allows you to obfuscate your seed
   phrase with “dead” keystrokes to guard against acoustic side-channel attacks.
   phrase with “dead” keystrokes to guard against acoustic side-channel attacks.
 - **Network privacy:** MMGen never “calls home” or checks for upgrades over the
 - **Network privacy:** MMGen never “calls home” or checks for upgrades over the

+ 1 - 2
mmgen/addrlist.py

@@ -20,11 +20,9 @@
 addrlist.py: Address list classes for the MMGen suite
 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 .util import qmsg,qmsg_r,suf,make_chksum_N,Msg
 from .objmethods import MMGenObject,Hilite,InitErrors
 from .objmethods import MMGenObject,Hilite,InitErrors
 from .obj import MMGenListItem,ListItemAttr,MMGenDict,WalletPassword
 from .obj import MMGenListItem,ListItemAttr,MMGenDict,WalletPassword
-from .seed import SeedID
 from .key import PrivKey
 from .key import PrivKey
 from .addr import MMGenID,MMGenAddrType,CoinAddr,AddrIdx,AddrListID,ViewKey
 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
 		le = self.entry_type
 		num,pos = (0,0)
 		num,pos = (0,0)
 
 
+		from hashlib import sha256,sha512
 		from .globalvars import g
 		from .globalvars import g
 
 
 		while pos != t_addrs:
 		while pos != t_addrs:

+ 5 - 1
mmgen/term.py

@@ -124,7 +124,7 @@ class MMGenTermLinuxStub(MMGenTermLinux):
 
 
 	@classmethod
 	@classmethod
 	def init(cls):
 	def init(cls):
-		pass
+		cls.stdin_fd = sys.stdin.fileno()
 
 
 	@classmethod
 	@classmethod
 	def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_chars=None,sleep=None):
 	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
 	get_char_raw = get_char
 
 
+	@classmethod
+	def kb_hold_protect(cls):
+		pass
+
 class MMGenTermMSWin(MMGenTerm):
 class MMGenTermMSWin(MMGenTerm):
 
 
 	@classmethod
 	@classmethod

+ 3 - 2
mmgen/tool/coin.py

@@ -25,9 +25,8 @@ generator_data = namedtuple('generator_data',['kg','ag'])
 
 
 from .common import tool_cmd_base
 from .common import tool_cmd_base
 
 
-from ..protocol import init_proto,init_genonly_altcoins,hash160
 from ..key import PrivKey
 from ..key import PrivKey
-from ..addr import KeyGenerator,AddrGenerator,MMGenAddrType,CoinAddr
+from ..addr import KeyGenerator,AddrGenerator,CoinAddr
 
 
 class tool_cmd(tool_cmd_base):
 class tool_cmd(tool_cmd_base):
 	"""
 	"""
@@ -134,6 +133,7 @@ class tool_cmd(tool_cmd_base):
 		if self.mmtype.name == 'segwit':
 		if self.mmtype.name == 'segwit':
 			return self.proto.pubkey2segwitaddr( pubkey )
 			return self.proto.pubkey2segwitaddr( pubkey )
 		else:
 		else:
+			from ..protocol import hash160
 			return self.pubhash2addr( hash160(pubkey).hex() )
 			return self.pubhash2addr( hash160(pubkey).hex() )
 
 
 	def pubhex2redeem_script(self,pubkeyhex:'sstr'): # new
 	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 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 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'
 		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() )
 		return self.pubhash2addr( hash160(bytes.fromhex(redeem_scripthex)).hex() )
 
 
 	def pubhash2addr(self,pubhashhex:'sstr'):
 	def pubhash2addr(self,pubhashhex:'sstr'):

+ 1 - 1
mmgen/tx.py

@@ -634,7 +634,7 @@ class MMGenTX:
 			from decimal import Decimal
 			from decimal import Decimal
 			tx_size = self.estimate_size()
 			tx_size = self.estimate_size()
 			ret = self.proto.coin_amt(
 			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 )
 				from_decimal = True )
 			if opt.verbose:
 			if opt.verbose:
 				msg(fmt(f"""
 				msg(fmt(f"""