Browse Source

proto.eth.tx.new: adjust gas with data only for non-token TXs

The MMGen Project 7 months ago
parent
commit
a4a31c050f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      mmgen/proto/eth/tx/new.py

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

@@ -81,11 +81,12 @@ class New(Base, TxBase.New):
 		self.txid = MMGenTxID(make_chksum_6(self.serialized).upper())
 
 	def set_gas_with_data(self, data):
-		self.gas = self.proto.coin_amt(self.dfl_gas + self.byte_cost * len(data), from_unit='wei')
+		if not self.is_token:
+			self.gas = self.proto.coin_amt(self.dfl_gas + self.byte_cost * len(data), from_unit='wei')
 
 	# one-shot method
 	def adj_gas_with_extra_data_len(self, extra_data_len):
-		if not hasattr(self, '_gas_adjusted'):
+		if not (self.is_token or hasattr(self, '_gas_adjusted')):
 			self.gas += self.proto.coin_amt(self.byte_cost * extra_data_len, from_unit='wei')
 			self._gas_adjusted = True