From 4b4d34fcceaf3a1e6d0d858e61624f33e148f6fd Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Mon, 17 May 2021 11:13:59 +0100 Subject: [PATCH] htlcswitch: change errors to warnings for issues caused by bogus incoming HTLC data --- htlcswitch/link.go | 14 +++++++------- lntest/itest/log_error_whitelist.txt | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 8d8423eb..2718ae63 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2217,7 +2217,7 @@ func (l *channelLink) CheckHtlcForward(payHash [32]byte, // any case, we'll cancel this HTLC. actualFee := incomingHtlcAmt - amtToForward if incomingHtlcAmt < amtToForward || actualFee < expectedFee { - l.log.Errorf("outgoing htlc(%x) has insufficient fee: "+ + l.log.Warnf("outgoing htlc(%x) has insufficient fee: "+ "expected %v, got %v", payHash[:], int64(expectedFee), int64(actualFee)) @@ -2239,7 +2239,7 @@ func (l *channelLink) CheckHtlcForward(payHash [32]byte, // sender messed up, or an intermediate node tampered with the HTLC. timeDelta := policy.TimeLockDelta if incomingTimeout < outgoingTimeout+timeDelta { - l.log.Errorf("incoming htlc(%x) has incorrect time-lock value: "+ + l.log.Warnf("incoming htlc(%x) has incorrect time-lock value: "+ "expected at least %v block delta, got %v block delta", payHash[:], timeDelta, incomingTimeout-outgoingTimeout) @@ -2286,7 +2286,7 @@ func (l *channelLink) canSendHtlc(policy ForwardingPolicy, // too small for the next hop. If so, then we'll cancel the HTLC // directly. if amt < policy.MinHTLCOut { - l.log.Errorf("outgoing htlc(%x) is too small: min_htlc=%v, "+ + l.log.Warnf("outgoing htlc(%x) is too small: min_htlc=%v, "+ "htlc_value=%v", payHash[:], policy.MinHTLCOut, amt) @@ -2305,7 +2305,7 @@ func (l *channelLink) canSendHtlc(policy ForwardingPolicy, // Next, ensure that the passed HTLC isn't too large. If so, we'll // cancel the HTLC directly. if policy.MaxHTLC != 0 && amt > policy.MaxHTLC { - l.log.Errorf("outgoing htlc(%x) is too large: max_htlc=%v, "+ + l.log.Warnf("outgoing htlc(%x) is too large: max_htlc=%v, "+ "htlc_value=%v", payHash[:], policy.MaxHTLC, amt) // As part of the returned error, we'll send our latest routing @@ -2322,7 +2322,7 @@ func (l *channelLink) canSendHtlc(policy ForwardingPolicy, // future, so we'll reject an HTLC if the outgoing expiration time is // too close to the current height. if timeout <= heightNow+l.cfg.OutgoingCltvRejectDelta { - l.log.Errorf("htlc(%x) has an expiry that's too soon: "+ + l.log.Warnf("htlc(%x) has an expiry that's too soon: "+ "outgoing_expiry=%v, best_height=%v", payHash[:], timeout, heightNow) failure := l.createFailureWithUpdate( @@ -2335,7 +2335,7 @@ func (l *channelLink) canSendHtlc(policy ForwardingPolicy, // Check absolute max delta. if timeout > l.cfg.MaxOutgoingCltvExpiry+heightNow { - l.log.Errorf("outgoing htlc(%x) has a time lock too far in "+ + l.log.Warnf("outgoing htlc(%x) has a time lock too far in "+ "the future: got %v, but maximum is %v", payHash[:], timeout-heightNow, l.cfg.MaxOutgoingCltvExpiry) @@ -2344,7 +2344,7 @@ func (l *channelLink) canSendHtlc(policy ForwardingPolicy, // Check to see if there is enough balance in this channel. if amt > l.Bandwidth() { - l.log.Errorf("insufficient bandwidth to route htlc: %v is "+ + l.log.Warnf("insufficient bandwidth to route htlc: %v is "+ "larger than %v", amt, l.Bandwidth()) failure := l.createFailureWithUpdate( func(upd *lnwire.ChannelUpdate) lnwire.FailureMessage { diff --git a/lntest/itest/log_error_whitelist.txt b/lntest/itest/log_error_whitelist.txt index 82fe9f3b..a51376df 100644 --- a/lntest/itest/log_error_whitelist.txt +++ b/lntest/itest/log_error_whitelist.txt @@ -109,8 +109,6 @@