Refactor/dont re-enter block_conencted on duplicate watch calls
[rust-lightning] / src / ln / peer_handler.rs
index 7af4c0e29f2c1f36f38f71237b01ae5e0fb91a20..3122e572e57fafcbd90e1c08c6c10b146d152c29 100644 (file)
@@ -334,6 +334,10 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
                                                                                Err(e) => {
                                                                                        match e {
                                                                                                msgs::DecodeError::UnknownRealmByte => return Err(PeerHandleError{ no_connection_possible: false }),
+                                                                                               msgs::DecodeError::UnknownRequiredFeature => {
+                                                                                                       log_debug!(self, "Got a channel/node announcement with an known required feature flag, you may want to udpate!");
+                                                                                                       continue;
+                                                                                               },
                                                                                                msgs::DecodeError::BadPublicKey => return Err(PeerHandleError{ no_connection_possible: false }),
                                                                                                msgs::DecodeError::BadSignature => return Err(PeerHandleError{ no_connection_possible: false }),
                                                                                                msgs::DecodeError::BadText => return Err(PeerHandleError{ no_connection_possible: false }),
@@ -575,11 +579,19 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
                                                                                        },
                                                                                        257 => {
                                                                                                let msg = try_potential_decodeerror!(msgs::NodeAnnouncement::decode(&msg_data[2..]));
-                                                                                               try_potential_handleerror!(self.message_handler.route_handler.handle_node_announcement(&msg));
+                                                                                               let should_forward = try_potential_handleerror!(self.message_handler.route_handler.handle_node_announcement(&msg));
+
+                                                                                               if should_forward {
+                                                                                                       // TODO: forward msg along to all our other peers!
+                                                                                               }
                                                                                        },
                                                                                        258 => {
                                                                                                let msg = try_potential_decodeerror!(msgs::ChannelUpdate::decode(&msg_data[2..]));
-                                                                                               try_potential_handleerror!(self.message_handler.route_handler.handle_channel_update(&msg));
+                                                                                               let should_forward = try_potential_handleerror!(self.message_handler.route_handler.handle_channel_update(&msg));
+
+                                                                                               if should_forward {
+                                                                                                       // TODO: forward msg along to all our other peers!
+                                                                                               }
                                                                                        },
                                                                                        _ => {
                                                                                                if (msg_type & 1) == 0 {