X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fln%2Frouter.rs;h=6bc319d59b8145de6162f47c7c78d746fd318a12;hb=91b23a075442107a93d00c6db1d7f5ffe54f715b;hp=e7f689e5fb85749dabcf25f5370940cb59b0f93f;hpb=187f28db03549d4b008eccefb948987c2bb1234f;p=rust-lightning diff --git a/src/ln/router.rs b/src/ln/router.rs index e7f689e5..6bc319d5 100644 --- a/src/ln/router.rs +++ b/src/ln/router.rs @@ -199,6 +199,10 @@ impl RoutingMessageHandler for Router { } fn handle_channel_announcement(&self, msg: &msgs::ChannelAnnouncement) -> Result { + if msg.contents.node_id_1 == msg.contents.node_id_2 || msg.contents.bitcoin_key_1 == msg.contents.bitcoin_key_2 { + return Err(HandleError{err: "Channel announcement node had a channel with itself", action: Some(ErrorAction::IgnoreError)}); + } + let msg_hash = Message::from_slice(&Sha256dHash::from_data(&msg.contents.encode()[..])[..]).unwrap(); secp_verify_sig!(self.secp_ctx, &msg_hash, &msg.node_signature_1, &msg.contents.node_id_1); secp_verify_sig!(self.secp_ctx, &msg_hash, &msg.node_signature_2, &msg.contents.node_id_2); @@ -222,7 +226,7 @@ impl RoutingMessageHandler for Router { //to the new HTLC max field in channel_update }, Err(ChainError::NotSupported) => { - // Tenatively accept, potentially exposing us to DoS attacks + // Tentatively accept, potentially exposing us to DoS attacks }, Err(ChainError::NotWatched) => { return Err(HandleError{err: "Channel announced on an unknown chain", action: Some(ErrorAction::IgnoreError)});