htlcswitch: refactor dust handling to use ChannelParty

This commit is contained in:
Keagan McClelland committed 2024-07-31 14:50:27 -07:00
1 parent 1d65f5bd12
commit 1f9cac5f80
6 files changed
+54 -37

No files matched your search

+8 -4
View File
@@ -2788,8 +2788,12 @@ func (s *Switch) dustExceedsFeeThreshold(link ChannelLink,
isDust := link.getDustClosure()
// Evaluate if the HTLC is dust on either sides' commitment.
isLocalDust := isDust(feeRate, incoming, true, amount.ToSatoshis())
isRemoteDust := isDust(feeRate, incoming, false, amount.ToSatoshis())
isLocalDust := isDust(
feeRate, incoming, lntypes.Local, amount.ToSatoshis(),
)
isRemoteDust := isDust(
feeRate, incoming, lntypes.Remote, amount.ToSatoshis(),
)
if !(isLocalDust || isRemoteDust) {
// If the HTLC is not dust on either commitment, it's fine to
@@ -2807,7 +2811,7 @@ func (s *Switch) dustExceedsFeeThreshold(link ChannelLink,
// sum for it.
if isLocalDust {
localSum := link.getDustSum(
false, fn.None[chainfee.SatPerKWeight](),
lntypes.Local, fn.None[chainfee.SatPerKWeight](),
)
localSum += localMailDust
@@ -2827,7 +2831,7 @@ func (s *Switch) dustExceedsFeeThreshold(link ChannelLink,
// reached this point.
if isRemoteDust {
remoteSum := link.getDustSum(
true, fn.None[chainfee.SatPerKWeight](),
lntypes.Remote, fn.None[chainfee.SatPerKWeight](),
)
remoteSum += remoteMailDust