1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-21 14:04:10 +01:00

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.
This commit is contained in:
Bastien Teinturier 2023-11-03 13:24:42 +01:00 committed by GitHub
parent ca3f6814a4
commit a3d90ad18a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)