Clarify the error message when we disconnect a peer
authorMatt Corallo <git@bluematt.me>
Fri, 21 Apr 2023 14:39:01 +0000 (14:39 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 21 Apr 2023 14:39:01 +0000 (14:39 +0000)
We very regularly receive confusion over the super generic
"Peer sent invalid data or we decided to disconnect due to a
protocol error" message, which doesn't say very much. Usually, we
end up disconnecting because we have a duplicate connection with a
peer, which doesn't merit such a scary message.

Instead, here we clarify the error message to just refer to the
fact that we're disconnecting, and note that its usually a dup
connection in a parenthetical.

lightning/src/ln/peer_handler.rs

index 8ec9d72955d093aabda322e896a1998bafb27e3a..2fbb22e889e318f95e3167841a0dca554b57ded5 100644 (file)
@@ -1056,7 +1056,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
                match self.do_read_event(peer_descriptor, data) {
                        Ok(res) => Ok(res),
                        Err(e) => {
-                               log_trace!(self.logger, "Peer sent invalid data or we decided to disconnect due to a protocol error");
+                               log_trace!(self.logger, "Disconnecting peer due to a protocol error (usually a duplicate connection).");
                                self.disconnect_event_internal(peer_descriptor);
                                Err(e)
                        }