@@ -2814,14 +2814,26 @@ func (l *channelLink) exceedsFeeExposureLimit(
28142814 // future commitment transaction with the fee-rate.
28152815 totalLocalDust := localDustSum + lnwire .NewMSatFromSatoshis (localFee )
28162816 if totalLocalDust > l .cfg .MaxFeeExposure {
2817+ l .log .Debugf ("ChannelLink(%v): exceeds fee exposure limit: " +
2818+ "local dust: %v, local fee: %v" , l .ShortChanID (),
2819+ totalLocalDust , localFee )
2820+
28172821 return true , nil
28182822 }
28192823
28202824 totalRemoteDust := remoteDustSum + lnwire .NewMSatFromSatoshis (
28212825 remoteFee ,
28222826 )
28232827
2824- return totalRemoteDust > l .cfg .MaxFeeExposure , nil
2828+ if totalRemoteDust > l .cfg .MaxFeeExposure {
2829+ l .log .Debugf ("ChannelLink(%v): exceeds fee exposure limit: " +
2830+ "remote dust: %v, remote fee: %v" , l .ShortChanID (),
2831+ totalRemoteDust , remoteFee )
2832+
2833+ return true , nil
2834+ }
2835+
2836+ return false , nil
28252837}
28262838
28272839// isOverexposedWithHtlc calculates whether the proposed HTLC will make the
@@ -2860,8 +2872,10 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28602872 commitFee = l .getCommitFee (true )
28612873 }
28622874
2863- localDustSum += lnwire .NewMSatFromSatoshis (commitFee )
2864- remoteDustSum += lnwire .NewMSatFromSatoshis (commitFee )
2875+ commitFeeMSat := lnwire .NewMSatFromSatoshis (commitFee )
2876+
2877+ localDustSum += commitFeeMSat
2878+ remoteDustSum += commitFeeMSat
28652879
28662880 // Calculate the additional fee increase if this is a non-dust HTLC.
28672881 weight := lntypes .WeightUnit (input .HTLCWeight )
@@ -2881,6 +2895,10 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28812895
28822896 if localDustSum > l .cfg .MaxFeeExposure {
28832897 // The max fee exposure was exceeded.
2898+ l .log .Debugf ("ChannelLink(%v): HTLC %v makes the channel " +
2899+ "overexposed, total local dust: %v (current commit " +
2900+ "fee: %v)" , l .ShortChanID (), htlc , localDustSum )
2901+
28842902 return true
28852903 }
28862904
@@ -2894,7 +2912,16 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28942912 remoteDustSum += additional
28952913 }
28962914
2897- return remoteDustSum > l .cfg .MaxFeeExposure
2915+ if remoteDustSum > l .cfg .MaxFeeExposure {
2916+ // The max fee exposure was exceeded.
2917+ l .log .Debugf ("ChannelLink(%v): HTLC %v makes the channel " +
2918+ "overexposed, total remote dust: %v (current commit " +
2919+ "fee: %v)" , l .ShortChanID (), htlc , remoteDustSum )
2920+
2921+ return true
2922+ }
2923+
2924+ return false
28982925}
28992926
29002927// dustClosure is a function that evaluates whether an HTLC is dust. It returns
0 commit comments