@@ -902,7 +902,11 @@ 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 :: 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) => {
906
910
log_gossip ! ( self . logger, "Got a channel/node announcement with an unknown required feature flag, you may want to update!" ) ;
907
911
continue ;
908
912
}
@@ -916,6 +920,11 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
916
920
self . enqueue_message ( peer, & msgs:: WarningMessage { channel_id : [ 0 ; 32 ] , data : "Unreadable/bogus gossip message" . to_owned ( ) } ) ;
917
921
continue ;
918
922
}
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
+ }
919
928
( msgs:: DecodeError :: UnknownVersion , _) => return Err ( PeerHandleError { no_connection_possible : false } ) ,
920
929
( msgs:: DecodeError :: InvalidValue , _) => {
921
930
log_debug ! ( self . logger, "Got an invalid value while deserializing message" ) ;
0 commit comments