From 788c94bdcdd3216d7c2743cb698eea9df938bef0 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Sat, 15 May 2021 11:06:56 +0100 Subject: [PATCH 1/5] htlcswitch: fix log message --- htlcswitch/link.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 9d6ad673..e4f49b3d 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -640,7 +640,7 @@ func (l *channelLink) createFailureWithUpdate( // flow. We'll compare out commitment chains with the remote party, and re-send // either a danging commit signature, a revocation, or both. func (l *channelLink) syncChanStates() error { - l.log.Info("attempting to re-resynchronize") + l.log.Info("attempting to re-synchronize") // First, we'll generate our ChanSync message to send to the other // side. Based on this message, the remote party will decide if they From ac4742c2c5268ec9deb1f35b07099685cbcc4202 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Sat, 15 May 2021 11:07:13 +0100 Subject: [PATCH 2/5] htlcswitch: fix documentation --- htlcswitch/link.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index e4f49b3d..8a6c5745 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2276,7 +2276,7 @@ func (l *channelLink) CheckHtlcTransit(payHash [32]byte, ) } -// htlcSatifiesPolicyOutgoing checks whether the given htlc parameters satisfy +// canSendHtlc checks whether the given htlc parameters satisfy // the channel's amount and time lock constraints. func (l *channelLink) canSendHtlc(policy ForwardingPolicy, payHash [32]byte, amt lnwire.MilliSatoshi, timeout uint32, From 378bc08e16078abdfb244cd17b819c0d67530445 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Sat, 15 May 2021 11:07:51 +0100 Subject: [PATCH 3/5] htlcswitch: add detailed "insufficient bandwidth" log message fixes #5250 --- htlcswitch/link.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 8a6c5745..3c52ae27 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2344,6 +2344,8 @@ 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 "+ + "larger than %v", amt, l.Bandwidth()) failure := l.createFailureWithUpdate( func(upd *lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewTemporaryChannelFailure(upd) From 2ae82df2fa5659c7bcb72c254d6cff035ca70316 Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Mon, 17 May 2021 11:10:58 +0100 Subject: [PATCH 4/5] htlcswitch: fix typo --- htlcswitch/link.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 3c52ae27..8d8423eb 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1558,7 +1558,7 @@ func (l *channelLink) cleanupSpuriousResponse(pkt *htlcPacket) { // If the htlc packet doesn't have a source reference, it is unsafe to // proceed, as skipping this ack may cause the htlc to be reforwarded. if pkt.sourceRef == nil { - l.log.Errorf("uanble to cleanup response for incoming "+ + l.log.Errorf("unable to cleanup response for incoming "+ "circuit-key=%v, does not contain source reference", inKey) return From 4b4d34fcceaf3a1e6d0d858e61624f33e148f6fd Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Mon, 17 May 2021 11:13:59 +0100 Subject: [PATCH 5/5] 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 @@