From a3d90ad18aa3e1d351817a6c0f1e06d8a9479a71 Mon Sep 17 00:00:00 2001 From: Bastien Teinturier <31281497+t-bast@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:24:42 +0100 Subject: [PATCH] Use local dust limit in local commit fee computation (#2765) Whenever we use the local commit, we must use the local dust limit to trim HTLCs. Similarly, whenever we use the remote commit, we must use the remote dust limit. --- .../src/main/scala/fr/acinq/eclair/channel/Commitments.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala b/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala index 26665bd02b..b976b65a7a 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala @@ -506,7 +506,7 @@ case class Commitment(fundingTxIndex: Long, val incomingHtlcs = reduced.htlcs.collect(DirectedHtlc.incoming) // note that the initiator pays the fee, so if sender != initiator, both sides will have to afford this payment - val fees = commitTxTotalCost(params.remoteParams.dustLimit, reduced, params.commitmentFormat) + val fees = commitTxTotalCost(params.localParams.dustLimit, reduced, params.commitmentFormat) // NB: we don't enforce the funderFeeReserve (see sendAdd) because it would confuse a remote initiator that doesn't have this mitigation in place // We could enforce it once we're confident a large portion of the network implements it. val missingForSender = reduced.toRemote - remoteChannelReserve(params) - (if (params.localParams.isInitiator) 0.sat else fees)