Skip to content

Commit

Permalink
Use local dust limit in local commit fee computation (#2765)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
t-bast authored Nov 3, 2023
1 parent ca3f681 commit a3d90ad
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a3d90ad

Please sign in to comment.