electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 8a1052330d9a7bbb239d5ecea6c1bef94b3e16f2
parent 261c492c37d45193b808b9c91c6b3e5549dc9c42
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed, 10 Jul 2019 16:35:40 +0200

wallet: loosen bump_fee sanity check further

fixes #5502

Diffstat:
Melectrum/wallet.py | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/electrum/wallet.py b/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