@@ -902,7 +902,11 @@ 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 :: UnknownRequiredFeature , _) => {
905+ // Note that to avoid recursion we never call
906+ // `do_attempt_write_data` from here, causing
907+ // the messages enqueued here to not actually
908+ // be sent before the peer is disconnected.
909+ ( msgs:: DecodeError :: UnknownRequiredFeature , Some ( ty) ) if is_gossip_msg ( ty) => {
906910 log_gossip ! ( self . logger, "Got a channel/node announcement with an unknown required feature flag, you may want to update!" ) ;
907911 continue ;
908912 }
@@ -916,6 +920,11 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
916920 self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unreadable/bogus gossip message" . to_owned ( ) } ) ;
917921 continue ;
918922 }
923+ ( msgs:: DecodeError :: UnknownRequiredFeature , ty) => {
924+ log_gossip ! ( self . logger, "Received a message with an unknown required feature flag or TLV, you may want to update!" ) ;
925+ self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : format ! ( "Received an unknown required feature/TLV in message type {:?}" , ty) } ) ;
926+ return Err ( PeerHandleError { no_connection_possible : false } ) ;
927+ }
919928 ( msgs:: DecodeError :: UnknownVersion , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
920929 ( msgs:: DecodeError :: InvalidValue , _) => {
921930 log_debug ! ( self . logger, "Got an invalid value while deserializing message" ) ;
0 commit comments