@@ -2727,10 +2727,10 @@ func (l *channelLink) MayAddOutgoingHtlc(amt lnwire.MilliSatoshi) error {
27272727// method.
27282728//
27292729// NOTE: Part of the dustHandler interface.
2730- func (l * channelLink ) getDustSum (remote bool ,
2730+ func (l * channelLink ) getDustSum (whoseCommit lntypes. ChannelParty ,
27312731 dryRunFee fn.Option [chainfee.SatPerKWeight ]) lnwire.MilliSatoshi {
27322732
2733- return l .channel .GetDustSum (remote , dryRunFee )
2733+ return l .channel .GetDustSum (whoseCommit , dryRunFee )
27342734}
27352735
27362736// getFeeRate is a wrapper method that retrieves the underlying channel's
@@ -2784,8 +2784,8 @@ func (l *channelLink) exceedsFeeExposureLimit(
27842784
27852785 // Get the sum of dust for both the local and remote commitments using
27862786 // this "dry-run" fee.
2787- localDustSum := l .getDustSum (false , dryRunFee )
2788- remoteDustSum := l .getDustSum (true , dryRunFee )
2787+ localDustSum := l .getDustSum (lntypes . Local , dryRunFee )
2788+ remoteDustSum := l .getDustSum (lntypes . Remote , dryRunFee )
27892789
27902790 // Calculate the local and remote commitment fees using this dry-run
27912791 // fee.
@@ -2826,12 +2826,16 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28262826 amount := htlc .Amount .ToSatoshis ()
28272827
28282828 // See if this HTLC is dust on both the local and remote commitments.
2829- isLocalDust := dustClosure (feeRate , incoming , true , amount )
2830- isRemoteDust := dustClosure (feeRate , incoming , false , amount )
2829+ isLocalDust := dustClosure (feeRate , incoming , lntypes . Local , amount )
2830+ isRemoteDust := dustClosure (feeRate , incoming , lntypes . Remote , amount )
28312831
28322832 // Calculate the dust sum for the local and remote commitments.
2833- localDustSum := l .getDustSum (false , fn .None [chainfee.SatPerKWeight ]())
2834- remoteDustSum := l .getDustSum (true , fn .None [chainfee.SatPerKWeight ]())
2833+ localDustSum := l .getDustSum (
2834+ lntypes .Local , fn .None [chainfee.SatPerKWeight ](),
2835+ )
2836+ remoteDustSum := l .getDustSum (
2837+ lntypes .Remote , fn .None [chainfee.SatPerKWeight ](),
2838+ )
28352839
28362840 // Grab the larger of the local and remote commitment fees w/o dust.
28372841 commitFee := l .getCommitFee (false )
@@ -2882,25 +2886,26 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28822886// the HTLC is incoming (i.e. one that the remote sent), a boolean denoting
28832887// whether to evaluate on the local or remote commit, and finally an HTLC
28842888// amount to test.
2885- type dustClosure func (chainfee.SatPerKWeight , bool , bool , btcutil.Amount ) bool
2889+ type dustClosure func (feerate chainfee.SatPerKWeight , incoming bool ,
2890+ whoseCommit lntypes.ChannelParty , amt btcutil.Amount ) bool
28862891
28872892// dustHelper is used to construct the dustClosure.
28882893func dustHelper (chantype channeldb.ChannelType , localDustLimit ,
28892894 remoteDustLimit btcutil.Amount ) dustClosure {
28902895
2891- isDust := func (feerate chainfee.SatPerKWeight , incoming ,
2892- localCommit bool , amt btcutil.Amount ) bool {
2896+ isDust := func (feerate chainfee.SatPerKWeight , incoming bool ,
2897+ whoseCommit lntypes. ChannelParty , amt btcutil.Amount ) bool {
28932898
2894- if localCommit {
2895- return lnwallet . HtlcIsDust (
2896- chantype , incoming , true , feerate , amt ,
2897- localDustLimit ,
2898- )
2899+ var dustLimit btcutil. Amount
2900+ if whoseCommit . IsLocal () {
2901+ dustLimit = localDustLimit
2902+ } else {
2903+ dustLimit = remoteDustLimit
28992904 }
29002905
29012906 return lnwallet .HtlcIsDust (
2902- chantype , incoming , false , feerate , amt ,
2903- remoteDustLimit ,
2907+ chantype , incoming , whoseCommit , feerate , amt ,
2908+ dustLimit ,
29042909 )
29052910 }
29062911
0 commit comments