]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add logging on receipt of unknown message types.
authorMatt Corallo <git@bluematt.me>
Mon, 24 Feb 2020 23:38:55 +0000 (18:38 -0500)
committerMatt Corallo <git@bluematt.me>
Thu, 27 Feb 2020 20:46:31 +0000 (15:46 -0500)
This should make peer disconnection easier to debug.

lightning/src/ln/peer_handler.rs

index 8aff2fc5608917f6b63f4b21542c75f5c4401e2f..049aae7015a905d9508e05c1bd33768e5d7c6df0 100644 (file)
@@ -755,10 +755,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
 
                                                                                        // Unknown messages:
                                                                                        wire::Message::Unknown(msg_type) if msg_type.is_even() => {
+                                                                                               log_debug!(self, "Received unknown even message of type {}, disconnecting peer!", msg_type);
                                                                                                // Fail the channel if message is an even, unknown type as per BOLT #1.
                                                                                                return Err(PeerHandleError{ no_connection_possible: true });
                                                                                        },
-                                                                                       wire::Message::Unknown(_) => {},
+                                                                                       wire::Message::Unknown(msg_type) => {
+                                                                                               log_trace!(self, "Received unknown odd message of type {}, ignoring", msg_type);
+                                                                                       },
                                                                                }
                                                                        }
                                                                }