Skip to content

Commit 5c61dd7

Browse files
committed
htlcswitch: increase log
1 parent f46ae2f commit 5c61dd7

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

htlcswitch/link.go

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,14 +2807,26 @@ func (l *channelLink) exceedsFeeExposureLimit(
28072807
// future commitment transaction with the fee-rate.
28082808
totalLocalDust := localDustSum + lnwire.NewMSatFromSatoshis(localFee)
28092809
if totalLocalDust > l.cfg.MaxFeeExposure {
2810+
l.log.Debugf("ChannelLink(%v): exceeds fee exposure limit: "+
2811+
"local dust: %v, local fee: %v", l.ShortChanID(),
2812+
totalLocalDust, localFee)
2813+
28102814
return true, nil
28112815
}
28122816

28132817
totalRemoteDust := remoteDustSum + lnwire.NewMSatFromSatoshis(
28142818
remoteFee,
28152819
)
28162820

2817-
return totalRemoteDust > l.cfg.MaxFeeExposure, nil
2821+
if totalRemoteDust > l.cfg.MaxFeeExposure {
2822+
l.log.Debugf("ChannelLink(%v): exceeds fee exposure limit: "+
2823+
"remote dust: %v, remote fee: %v", l.ShortChanID(),
2824+
totalRemoteDust, remoteFee)
2825+
2826+
return true, nil
2827+
}
2828+
2829+
return false, nil
28182830
}
28192831

28202832
// isOverexposedWithHtlc calculates whether the proposed HTLC will make the
@@ -2853,8 +2865,10 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28532865
commitFee = l.getCommitFee(true)
28542866
}
28552867

2856-
localDustSum += lnwire.NewMSatFromSatoshis(commitFee)
2857-
remoteDustSum += lnwire.NewMSatFromSatoshis(commitFee)
2868+
commitFeeMSat := lnwire.NewMSatFromSatoshis(commitFee)
2869+
2870+
localDustSum += commitFeeMSat
2871+
remoteDustSum += commitFeeMSat
28582872

28592873
// Calculate the additional fee increase if this is a non-dust HTLC.
28602874
weight := lntypes.WeightUnit(input.HTLCWeight)
@@ -2874,6 +2888,10 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28742888

28752889
if localDustSum > l.cfg.MaxFeeExposure {
28762890
// The max fee exposure was exceeded.
2891+
l.log.Debugf("ChannelLink(%v): HTLC %v makes the channel "+
2892+
"overexposed, total local dust: %v (current commit "+
2893+
"fee: %v)", l.ShortChanID(), htlc, localDustSum)
2894+
28772895
return true
28782896
}
28792897

@@ -2887,7 +2905,16 @@ func (l *channelLink) isOverexposedWithHtlc(htlc *lnwire.UpdateAddHTLC,
28872905
remoteDustSum += additional
28882906
}
28892907

2890-
return remoteDustSum > l.cfg.MaxFeeExposure
2908+
if remoteDustSum > l.cfg.MaxFeeExposure {
2909+
// The max fee exposure was exceeded.
2910+
l.log.Debugf("ChannelLink(%v): HTLC %v makes the channel "+
2911+
"overexposed, total remote dust: %v (current commit "+
2912+
"fee: %v)", l.ShortChanID(), htlc, remoteDustSum)
2913+
2914+
return true
2915+
}
2916+
2917+
return false
28912918
}
28922919

28932920
// dustClosure is a function that evaluates whether an HTLC is dust. It returns

0 commit comments

Comments
 (0)