@@ -902,22 +902,27 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
902
902
Ok ( x) => x,
903
903
Err ( e) => {
904
904
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 , _) => {
907
912
log_gossip ! ( self . logger, "Got a channel/node announcement with an unknown required feature flag, you may want to update!" ) ;
908
913
continue ;
909
914
}
910
- msgs:: DecodeError :: InvalidValue => {
915
+ ( msgs:: DecodeError :: InvalidValue , _ ) => {
911
916
log_debug ! ( self . logger, "Got an invalid value while deserializing message" ) ;
912
917
return Err ( PeerHandleError { no_connection_possible : false } ) ;
913
918
}
914
- msgs:: DecodeError :: ShortRead => {
919
+ ( msgs:: DecodeError :: ShortRead , _ ) => {
915
920
log_debug ! ( self . logger, "Deserialization failed due to shortness of message" ) ;
916
921
return Err ( PeerHandleError { no_connection_possible : false } ) ;
917
922
}
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 , _ ) => {
921
926
log_gossip ! ( self . logger, "We don't support zlib-compressed message fields, sending a warning and ignoring message" ) ;
922
927
self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unsupported message compression: zlib" . to_owned ( ) } ) ;
923
928
continue ;
0 commit comments