tx: move check_fee() to base class
This commit is contained in:
parent
39f82f771b
commit
4709b015b5
5 changed files with 6 additions and 7 deletions
|
|
@ -23,7 +23,6 @@ class Base(TxBase):
|
|||
# for simple sends with no data, startGas = 21000
|
||||
contract_desc = 'contract'
|
||||
usr_contract_data = b''
|
||||
disable_fee_check = False
|
||||
|
||||
@property
|
||||
def nondata_outputs(self):
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class Base(TxBase):
|
|||
dfl_fee = 2000000
|
||||
dfl_gas = 800000
|
||||
usr_contract_data = None
|
||||
disable_fee_check = False
|
||||
|
||||
@property
|
||||
def nondata_outputs(self):
|
||||
|
|
|
|||
|
|
@ -85,11 +85,6 @@ class New:
|
|||
def check_chg_addr_is_wallet_addr(self):
|
||||
pass
|
||||
|
||||
def check_fee(self):
|
||||
if not self.disable_fee_check:
|
||||
if self.usr_fee and self.usr_fee > self.proto.max_tx_fee:
|
||||
die('MaxFeeExceeded', f'{self.usr_fee} > max fee ({self.proto.max_tx_fee})')
|
||||
|
||||
@property
|
||||
def total_gas(self):
|
||||
return self.gas
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ class Base(MMGenObject):
|
|||
is_compat = False
|
||||
compat_data = None
|
||||
has_comment = True
|
||||
disable_fee_check = False
|
||||
swap_attrs = {
|
||||
'swap_proto': None,
|
||||
'swap_quote_expiry': None,
|
||||
|
|
|
|||
|
|
@ -156,6 +156,11 @@ class New(Base):
|
|||
fee = line_input(self.cfg, self.usr_fee_prompt)
|
||||
desc = 'User-selected'
|
||||
|
||||
def check_fee(self):
|
||||
if not self.disable_fee_check:
|
||||
if self.usr_fee and self.usr_fee > self.proto.max_tx_fee:
|
||||
die('MaxFeeExceeded', f'{self.usr_fee} > max fee ({self.proto.max_tx_fee})')
|
||||
|
||||
# we don't know fee yet, so perform preliminary check with fee == 0
|
||||
async def precheck_sufficient_funds(self, inputs_sum, sel_unspent, outputs_sum):
|
||||
if self.twuo.total < outputs_sum:
|
||||
|
|
|
|||
Loading…
Reference in a new issue