Browse Source

wallet: loosen bump_fee sanity check further

fixes #5502
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 6 years ago
parent
commit
8a1052330d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 11
      electrum/wallet.py

11
electrum/wallet.py

@ -902,6 +902,7 @@ class Abstract_Wallet(AddressSynchronizer):
""" """
if tx.is_final(): if tx.is_final():
raise CannotBumpFee(_('Cannot bump fee') + ': ' + _('transaction is final')) raise CannotBumpFee(_('Cannot bump fee') + ': ' + _('transaction is final'))
new_fee_rate = quantize_feerate(new_fee_rate) # strip excess precision
old_tx_size = tx.estimated_size() old_tx_size = tx.estimated_size()
old_fee = self.get_tx_fee(tx) old_fee = self.get_tx_fee(tx)
if old_fee is None: if old_fee is None:
@ -925,10 +926,12 @@ class Abstract_Wallet(AddressSynchronizer):
tx=tx, new_fee_rate=new_fee_rate) tx=tx, new_fee_rate=new_fee_rate)
method_used = 2 method_used = 2
actual_new_fee_rate = tx_new.get_fee() / tx_new.estimated_size() target_min_fee = new_fee_rate * tx_new.estimated_size()
if quantize_feerate(actual_new_fee_rate) < quantize_feerate(new_fee_rate): actual_fee = tx_new.get_fee()
raise Exception(f"bump_fee feerate target was not met (method: {method_used}). " if actual_fee + 1 < target_min_fee:
f"got {actual_new_fee_rate}, expected >={new_fee_rate}") raise Exception(f"bump_fee fee target was not met (method: {method_used}). "
f"got {actual_fee}, expected >={target_min_fee}. "
f"target rate was {new_fee_rate}")
tx_new.locktime = get_locktime_for_new_transaction(self.network) tx_new.locktime = get_locktime_for_new_transaction(self.network)
return tx_new return tx_new

Loading…
Cancel
Save