@@ -902,22 +902,27 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
902902 Ok ( x) => x,
903903 Err ( e) => {
904904 match e {
905- msgs:: DecodeError :: UnknownVersion => return Err ( PeerHandleError { no_connection_possible : false } ) ,
906- msgs:: DecodeError :: UnknownRequiredFeature => {
905+ ( _, Some ( ty) ) if is_gossip_msg ( ty) => {
906+ log_gossip ! ( self . logger, "Got an invalid value while deserializing a gossip message" ) ;
907+ self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unreadable/bogus gossip message" . to_owned ( ) } ) ;
908+ continue ;
909+ }
910+ ( msgs:: DecodeError :: UnknownVersion , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
911+ ( msgs:: DecodeError :: UnknownRequiredFeature , _) => {
907912 log_gossip ! ( self . logger, "Got a channel/node announcement with an unknown required feature flag, you may want to update!" ) ;
908913 continue ;
909914 }
910- msgs:: DecodeError :: InvalidValue => {
915+ ( msgs:: DecodeError :: InvalidValue , _ ) => {
911916 log_debug ! ( self . logger, "Got an invalid value while deserializing message" ) ;
912917 return Err ( PeerHandleError { no_connection_possible : false } ) ;
913918 }
914- msgs:: DecodeError :: ShortRead => {
919+ ( msgs:: DecodeError :: ShortRead , _ ) => {
915920 log_debug ! ( self . logger, "Deserialization failed due to shortness of message" ) ;
916921 return Err ( PeerHandleError { no_connection_possible : false } ) ;
917922 }
918- msgs:: DecodeError :: BadLengthDescriptor => return Err ( PeerHandleError { no_connection_possible : false } ) ,
919- msgs:: DecodeError :: Io ( _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
920- msgs:: DecodeError :: UnsupportedCompression => {
923+ ( msgs:: DecodeError :: BadLengthDescriptor , _ ) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
924+ ( msgs:: DecodeError :: Io ( _ ) , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
925+ ( msgs:: DecodeError :: UnsupportedCompression , _ ) => {
921926 log_gossip ! ( self . logger, "We don't support zlib-compressed message fields, sending a warning and ignoring message" ) ;
922927 self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unsupported message compression: zlib" . to_owned ( ) } ) ;
923928 continue ;
0 commit comments