From 96b141c5038b11e51697f09d2571aef858087a7f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 13 Feb 2024 22:57:18 +0000 Subject: [PATCH] Make peers sending gossip out of order logging less scary Multiple times we've had users wonder why they see `Error handling message from.*; ignoring: Couldn't find channel for update` in their logs and wonder if its related to their channel force-closing. While this does indicate a peer is sending us gossip our of order (and thus misbehaving), its not relevant to channel operation and the logged message and level should indicate that. Thus, here, we move the level to Gossip and add "gossip" between "handling" and "message" (so it reads "Error handling gossip message from.*"). Fixes #2471 --- lightning/src/ln/peer_handler.rs | 6 ++++-- lightning/src/routing/gossip.rs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 0f206117..8d837637 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -33,7 +33,7 @@ use crate::onion_message::offers::{OffersMessage, OffersMessageHandler}; use crate::onion_message::packet::OnionMessageContents; use crate::routing::gossip::{NodeId, NodeAlias}; use crate::util::atomic_counter::AtomicCounter; -use crate::util::logger::{Logger, WithContext}; +use crate::util::logger::{Level, Logger, WithContext}; use crate::util::string::PrintableString; use crate::prelude::*; @@ -1329,7 +1329,9 @@ impl { - log_given_level!(logger, level, "Error handling message{}; ignoring: {}", OptionalFromDebugger(&peer_node_id), e.err); + log_given_level!(logger, level, "Error handling {}message{}; ignoring: {}", + if level == Level::Gossip { "gossip " } else { "" }, + OptionalFromDebugger(&peer_node_id), e.err); continue }, msgs::ErrorAction::IgnoreDuplicateGossip => continue, // Don't even bother logging these diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index 950ec79a..a4938f72 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -1925,7 +1925,10 @@ impl NetworkGraph where L::Target: Logger { None => { core::mem::drop(channels); self.pending_checks.check_hold_pending_channel_update(msg, full_msg)?; - return Err(LightningError{err: "Couldn't find channel for update".to_owned(), action: ErrorAction::IgnoreError}); + return Err(LightningError { + err: "Couldn't find channel for update".to_owned(), + action: ErrorAction::IgnoreAndLog(Level::Gossip), + }); }, Some(channel) => { if msg.htlc_maximum_msat > MAX_VALUE_MSAT { -- 2.30.2