Disallow duplicate Init messages from peers
[rust-lightning] / src / ln / peer_handler.rs
index 3d3588a4d8d9056bfa731f445bd77ef963ac98f8..8a4228851b7a7e3981e698ccc6cd05f3cb3e5d3b 100644 (file)
@@ -445,6 +445,9 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
                                                                                                if msg.local_features.requires_unknown_bits() {
                                                                                                        return Err(PeerHandleError{ no_connection_possible: true });
                                                                                                }
+                                                                                               if peer.their_global_features.is_some() {
+                                                                                                       return Err(PeerHandleError{ no_connection_possible: false });
+                                                                                               }
                                                                                                peer.their_global_features = Some(msg.global_features);
                                                                                                peer.their_local_features = Some(msg.local_features);