]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Disallow duplicate Init messages from peers 2018-09-channel-connection-cleanups
authorMatt Corallo <git@bluematt.me>
Sat, 8 Sep 2018 18:43:15 +0000 (14:43 -0400)
committerMatt Corallo <git@bluematt.me>
Sat, 8 Sep 2018 18:43:42 +0000 (14:43 -0400)
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);