Browse Source

proto.eth.tx: add mmid to output; check addrs, amt before signing

The MMGen Project 2 weeks ago
parent
commit
76a34a05b5
3 changed files with 9 additions and 1 deletions
  1. 1 1
      mmgen/data/version
  2. 2 0
      mmgen/proto/eth/tx/new.py
  3. 6 0
      mmgen/proto/eth/tx/unsigned.py

+ 1 - 1
mmgen/data/version

@@ -1 +1 @@
-15.1.dev20
+15.1.dev21

+ 2 - 0
mmgen/proto/eth/tx/new.py

@@ -96,6 +96,8 @@ class New(Base, TxBase.New):
 			amt      = self.proto.coin_amt(arg.amt or '0'),
 			is_chg   = not arg.amt)
 
+		self.add_mmaddrs_to_outputs(ad_f, ad_w)
+
 	def get_unspent_nums_from_user(self, unspent):
 		from ....ui import line_input
 		while True:

+ 6 - 0
mmgen/proto/eth/tx/unsigned.py

@@ -74,6 +74,12 @@ class Unsigned(Completed, TxBase.Unsigned):
 
 		o = self.txobj
 
+		m = 'mismatch -- a compromised online installation may have altered your serialized data!'
+		assert o['from'] == self.inputs[0].addr, f'from_addr {m}'
+		if self.outputs:
+			assert o['to'] == self.outputs[0].addr, f'to_addr {m}'
+			assert o['amt'] == self.outputs[0].amt, f'to_amt {m}'
+
 		msg_r(f'Signing transaction{tx_num_str}...')
 
 		try: