@@ -902,26 +902,31 @@ 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+ ( msgs:: DecodeError :: UnknownRequiredFeature , _) => {
907906 log_gossip ! ( self . logger, "Got a channel/node announcement with an unknown required feature flag, you may want to update!" ) ;
908907 continue ;
909908 }
910- msgs:: DecodeError :: InvalidValue => {
909+ ( msgs:: DecodeError :: UnsupportedCompression , _) => {
910+ log_gossip ! ( self . logger, "We don't support zlib-compressed message fields, sending a warning and ignoring message" ) ;
911+ self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unsupported message compression: zlib" . to_owned ( ) } ) ;
912+ continue ;
913+ }
914+ ( _, Some ( ty) ) if is_gossip_msg ( ty) => {
915+ log_gossip ! ( self . logger, "Got an invalid value while deserializing a gossip message" ) ;
916+ self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unreadable/bogus gossip message" . to_owned ( ) } ) ;
917+ continue ;
918+ }
919+ ( msgs:: DecodeError :: UnknownVersion , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
920+ ( msgs:: DecodeError :: InvalidValue , _) => {
911921 log_debug ! ( self . logger, "Got an invalid value while deserializing message" ) ;
912922 return Err ( PeerHandleError { no_connection_possible : false } ) ;
913923 }
914- msgs:: DecodeError :: ShortRead => {
924+ ( msgs:: DecodeError :: ShortRead , _ ) => {
915925 log_debug ! ( self . logger, "Deserialization failed due to shortness of message" ) ;
916926 return Err ( PeerHandleError { no_connection_possible : false } ) ;
917927 }
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 => {
921- log_gossip ! ( self . logger, "We don't support zlib-compressed message fields, sending a warning and ignoring message" ) ;
922- self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unsupported message compression: zlib" . to_owned ( ) } ) ;
923- continue ;
924- }
928+ ( msgs:: DecodeError :: BadLengthDescriptor , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
929+ ( msgs:: DecodeError :: Io ( _) , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
925930 }
926931 }
927932 } ;
0 commit comments