Browse Source

minor fixes and cleanups

The MMGen Project 2 years ago
parent
commit
8035688fb7

+ 3 - 0
mmgen/base_proto/bitcoin/tx/bump.py

@@ -15,6 +15,7 @@ base_proto.bitcoin.tx.bump: Bitcoin transaction bump class
 import mmgen.tx.bump as TxBase
 from .new import New
 from .completed import Completed
+from ....util import msg
 
 class Bump(Completed,New,TxBase.Bump):
 	desc = 'fee-bumped transaction'
@@ -31,6 +32,8 @@ class Bump(Completed,New,TxBase.Bump):
 
 	def convert_and_check_fee(self,tx_fee,desc):
 		ret = super().convert_and_check_fee(tx_fee,desc)
+		if ret == False:
+			return ret
 		if ret < self.min_fee:
 			msg('{} {c}: {} fee too small. Minimum fee: {} {c} ({} {})'.format(
 				ret.hl(),

+ 1 - 1
mmgen/base_proto/bitcoin/tx/new.py

@@ -16,7 +16,7 @@ import mmgen.tx.new as TxBase
 from .base import Base
 from ....opts import opt
 from ....obj import HexStr,MMGenTxID
-from ....util import dmsg,vmsg,make_chksum_6,die
+from ....util import msg,dmsg,vmsg,make_chksum_6,die
 
 class New(Base,TxBase.New):
 	usr_fee_prompt = 'Enter transaction fee: '

+ 5 - 4
mmgen/main_xmrwallet.py

@@ -62,8 +62,9 @@ opts_data = {
 """,
 	'notes': """
 
-All operations require a running Monero daemon.  Unless --daemon is specified,
-the monerod is assumed to be listening on localhost at the default RPC port.
+All operations except for ‘relay’ require a running Monero daemon.  Unless
+--daemon is specified, the monerod is assumed to be listening on localhost at
+the default RPC port.
 
 If --tx-relay-daemon is specified, the monerod at HOST:PORT will be used to
 relay any created transactions.  PROXY_HOST:PROXY_PORT, if specified, may
@@ -79,8 +80,8 @@ create    - create wallet for all or specified addresses in key-address file
 sync      - sync wallet for all or specified addresses in key-address file
 list      - same as 'sync', but also list detailed address info for accounts
 new       - create a new account in a wallet, or a new address in an account
-transfer  - transfer specified XMR amount to specified address from specified
-            wallet:account
+transfer  - transfer specified XMR amount from specified wallet:account to
+            specified address
 sweep     - sweep funds in specified wallet:account to new address in same
             account or new account in another wallet
 relay     - relay a transaction from a transaction file created using 'sweep'

+ 2 - 2
mmgen/proto/xmr.py

@@ -21,7 +21,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Base):
 	base_coin      = 'XMR'
 	base_proto     = 'Monero'
 	addr_ver_bytes = { '12': 'monero', '2a': 'monero_sub' }
-	addr_len       = 68
+	addr_len       = 64
 	wif_ver_num    = {}
 	pubkey_types   = ('monero',)
 	mmtypes        = ('M',)
@@ -57,7 +57,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Base):
 
 		assert ret[-4:] == chk, f'{ret[-4:].hex()}: incorrect checksum.  Correct value: {chk.hex()}'
 
-		return self.decode_addr_bytes(ret)
+		return self.decode_addr_bytes(ret[:-4])
 
 	def pubhash2addr(self,*args,**kwargs):
 		raise NotImplementedError('Monero addresses do not support pubhash2addr()')

+ 2 - 1
mmgen/tx/completed.py

@@ -40,7 +40,8 @@ class Completed(Base):
 			self.check_correct_chain()
 
 			if self.check_sigs() != self.signed:
-				die(1,'Transaction is {}signed!'.format('not' if self.signed else ''))
+				from ..util import die
+				die(1,'Transaction is {}signed!'.format('not ' if self.signed else ''))
 
 	@property
 	def info(self):

+ 6 - 3
mmgen/xmrwallet.py

@@ -126,7 +126,8 @@ class MoneroMMGenTX:
 						red(f'#{d.dest.account_address}')
 					)
 				)
-			return fmt("""
+
+			fs = """
 				Transaction info [Seed ID: {}. Network: {}]:
 				  TxID: {}
 				  Type: {}
@@ -134,7 +135,9 @@ class MoneroMMGenTX:
 				  Amt:  {} XMR
 				  Fee:  {} XMR
 				  Dest: {}
-			""",strip_char='\t',indent=indent).format(
+			"""
+
+			return fmt(fs,strip_char='\t',indent=indent).format(
 					d.seed_id.hl(), d.network.upper(),
 					d.txid.hl(),
 					blue(capfirst(d.op)),
@@ -143,7 +146,7 @@ class MoneroMMGenTX:
 					to_entry if d.dest else '',
 					d.amount.hl(),
 					d.fee.hl(),
-					d.dest_address.hl()
+					d.dest_address.hl(),
 				)
 
 		def write(self,delete_metadata=False):