Add logging on receipt of unknown message types.
[rust-lightning] / lightning / src / ln / peer_handler.rs
index ee706940a23dd4080559b7d22ee1ee12d98a0380..049aae7015a905d9508e05c1bd33768e5d7c6df0 100644 (file)
@@ -170,7 +170,7 @@ pub type SimpleArcPeerManager<SD, M, T> = Arc<PeerManager<SD, SimpleArcChannelMa
 /// usage of lightning-net-tokio (since tokio::spawn requires parameters with static lifetimes).
 /// But if this is not necessary, using a reference is more efficient. Defining these type aliases
 /// helps with issues such as long function definitions.
-pub type SimpleRefPeerManager<'a, 'b, SD, M, T> = PeerManager<SD, SimpleRefChannelManager<'a, 'b, M, T>>;
+pub type SimpleRefPeerManager<'a, 'b, 'c, SD, M, T> = PeerManager<SD, SimpleRefChannelManager<'a, 'b, 'c, M, T>>;
 
 /// A PeerManager manages a set of peers, described by their SocketDescriptor and marshalls socket
 /// events into messages which it passes on to its MessageHandlers.
@@ -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);
+                                                                                       },
                                                                                }
                                                                        }
                                                                }