1
0

lnutil: update ctx fee calculation for anchors

This commit is contained in:
bitromortac
2021-09-13 11:42:55 +02:00
committed by ThomasV
parent 22f5ff0d0e
commit c8bf515953
4 changed files with 21 additions and 7 deletions

View File

@@ -1354,6 +1354,7 @@ class Channel(AbstractChannel):
feerate=feerate,
is_local_initiator=self.constraints.is_initiator,
round_to_sat=False,
has_anchors=self.has_anchors()
)
htlc_fee_msat = fee_for_htlc_output(feerate=feerate)
htlc_trim_func = received_htlc_trim_threshold_sat if ctx_owner == receiver else offered_htlc_trim_threshold_sat
@@ -1364,6 +1365,7 @@ class Channel(AbstractChannel):
feerate=2 * feerate,
is_local_initiator=self.constraints.is_initiator,
round_to_sat=False,
has_anchors=self.has_anchors()
)[sender]
max_send_msat = sender_balance_msat - sender_reserve_msat - fee_spike_buffer
else:
@@ -1546,6 +1548,7 @@ class Channel(AbstractChannel):
num_htlcs=num_htlcs_in_ctx,
feerate=feerate,
is_local_initiator=self.constraints.is_initiator,
has_anchors=self.has_anchors()
)
remainder = sender_balance_msat - sender_reserve_msat - ctx_fees_msat[sender]
if remainder < 0:
@@ -1595,6 +1598,7 @@ class Channel(AbstractChannel):
num_htlcs=len(htlcs),
feerate=feerate,
is_local_initiator=self.constraints.is_initiator == (subject == LOCAL),
has_anchors=self.has_anchors(),
)
assert self.is_static_remotekey_enabled()
payment_pubkey = other_config.payment_basepoint.pubkey