Skip to content

Commit ff5ba7c

Browse files
committed
rbf: fix issues with bump_frr_through_decreasing_change
- break from loop if target is reached - recompute delta if there is no next iteration.
1 parent 54b6934 commit ff5ba7c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

electrum/wallet.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,8 @@ def _bump_fee_through_decreasing_change(
19481948
for o in s:
19491949
target_fee = int(math.ceil(tx.estimated_size() * new_fee_rate))
19501950
delta = target_fee - tx.get_fee()
1951+
if delta <= 0:
1952+
break
19511953
i = outputs.index(o)
19521954
if o.value - delta >= self.dust_threshold():
19531955
new_output_value = o.value - delta
@@ -1959,6 +1961,11 @@ def _bump_fee_through_decreasing_change(
19591961
del outputs[i]
19601962
# note: we mutated the outputs of tx, which will affect
19611963
# tx.estimated_size() in the next iteration
1964+
else:
1965+
# recompute delta if there was no next iteration
1966+
target_fee = int(math.ceil(tx.estimated_size() * new_fee_rate))
1967+
delta = target_fee - tx.get_fee()
1968+
19621969
if delta > 0:
19631970
raise CannotBumpFee(_('Could not find suitable outputs'))
19641971

0 commit comments

Comments
 (0)