Browse Source
wallet: loosen bump_fee sanity check further
fixes #5502
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
7 additions and
4 deletions
-
electrum/wallet.py
|
|
@ -902,6 +902,7 @@ class Abstract_Wallet(AddressSynchronizer): |
|
|
|
""" |
|
|
|
if tx.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_fee = self.get_tx_fee(tx) |
|
|
|
if old_fee is None: |
|
|
@ -925,10 +926,12 @@ class Abstract_Wallet(AddressSynchronizer): |
|
|
|
tx=tx, new_fee_rate=new_fee_rate) |
|
|
|
method_used = 2 |
|
|
|
|
|
|
|
actual_new_fee_rate = tx_new.get_fee() / tx_new.estimated_size() |
|
|
|
if quantize_feerate(actual_new_fee_rate) < quantize_feerate(new_fee_rate): |
|
|
|
raise Exception(f"bump_fee feerate target was not met (method: {method_used}). " |
|
|
|
f"got {actual_new_fee_rate}, expected >={new_fee_rate}") |
|
|
|
target_min_fee = new_fee_rate * tx_new.estimated_size() |
|
|
|
actual_fee = tx_new.get_fee() |
|
|
|
if actual_fee + 1 < target_min_fee: |
|
|
|
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) |
|
|
|
return tx_new |
|
|
|