Skip to content

Commit 50d48ae

Browse files
committed
fee_policy: move regtest fallback even deeper
1 parent 848e605 commit 50d48ae

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

electrum/fee_policy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ def fee_per_kb(self, network: 'Network') -> Optional[int]:
218218
"""Returns sat/kvB fee to pay for a txn.
219219
Note: might return None.
220220
"""
221-
if self.use_dynamic_estimates and constants.net is constants.BitcoinRegtest:
222-
return FEERATE_REGTEST_STATIC_FEE
223-
224221
if self.method == FeeMethod.FEERATE:
225222
fee_rate = self.value
226223
elif self.method == FeeMethod.MEMPOOL:
@@ -426,4 +423,7 @@ def eta_target_to_fee(self, num_blocks: int) -> Optional[int]:
426423
fee = self.data.get(num_blocks)
427424
if fee is not None:
428425
fee = int(fee)
426+
# fallback for regtest
427+
if fee is None and constants.net is constants.BitcoinRegtest:
428+
return FEERATE_REGTEST_STATIC_FEE
429429
return fee

electrum/lnworker.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
)
4141
from .fee_policy import (
4242
FeePolicy, FEERATE_FALLBACK_STATIC_FEE, FEE_LN_ETA_TARGET, FEE_LN_LOW_ETA_TARGET,
43-
FEERATE_PER_KW_MIN_RELAY_LIGHTNING, FEE_LN_MINIMUM_ETA_TARGET, FEERATE_REGTEST_STATIC_FEE
43+
FEERATE_PER_KW_MIN_RELAY_LIGHTNING, FEE_LN_MINIMUM_ETA_TARGET
4444
)
4545
from .invoices import Invoice, PR_UNPAID, PR_PAID, PR_INFLIGHT, PR_FAILED, LN_EXPIRY_NEVER, BaseInvoice
4646
from .bitcoin import COIN, opcodes, make_op_return, address_to_scripthash, DummyAddress
@@ -3075,10 +3075,7 @@ def current_target_feerate_per_kw(self, *, has_anchors: bool) -> Optional[int]:
30753075
target: int = FEE_LN_MINIMUM_ETA_TARGET if has_anchors else FEE_LN_ETA_TARGET
30763076
feerate_per_kvbyte = self.network.fee_estimates.eta_target_to_fee(target)
30773077
if feerate_per_kvbyte is None:
3078-
if constants.net is constants.BitcoinRegtest:
3079-
feerate_per_kvbyte = FEERATE_REGTEST_STATIC_FEE
3080-
else:
3081-
return None
3078+
return None
30823079
if has_anchors:
30833080
# set a floor of 5 sat/vb to have some safety margin in case the mempool
30843081
# grows quickly

0 commit comments

Comments
 (0)