From: Matt Corallo Date: Wed, 19 Sep 2018 21:33:05 +0000 (-0400) Subject: Log peer features in peer_handler (and check for all req bits) X-Git-Tag: v0.0.12~304^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=fe90e13f841548f2be0594854216c85889e71584;p=rust-lightning Log peer features in peer_handler (and check for all req bits) --- diff --git a/src/ln/peer_handler.rs b/src/ln/peer_handler.rs index 01416568b..20faf2500 100644 --- a/src/ln/peer_handler.rs +++ b/src/ln/peer_handler.rs @@ -451,14 +451,32 @@ impl PeerManager { 16 => { let msg = try_potential_decodeerror!(msgs::Init::read(&mut reader)); if msg.global_features.requires_unknown_bits() { + log_info!(self, "Peer global features required unknown version bits"); return Err(PeerHandleError{ no_connection_possible: true }); } if msg.local_features.requires_unknown_bits() { + log_info!(self, "Peer local features required unknown version bits"); + return Err(PeerHandleError{ no_connection_possible: true }); + } + if msg.local_features.requires_data_loss_protect() { + log_info!(self, "Peer local features required data_loss_protect"); + return Err(PeerHandleError{ no_connection_possible: true }); + } + if msg.local_features.requires_upfront_shutdown_script() { + log_info!(self, "Peer local features required upfront_shutdown_script"); return Err(PeerHandleError{ no_connection_possible: true }); } if peer.their_global_features.is_some() { return Err(PeerHandleError{ no_connection_possible: false }); } + + log_info!(self, "Received peer Init message: data_loss_protect: {}, initial_routing_sync: {}, upfront_shutdown_script: {}, unkown local flags: {}, unknown global flags: {}", + if msg.local_features.supports_data_loss_protect() { "supported" } else { "not supported"}, + if msg.local_features.initial_routing_sync() { "requested" } else { "not requested" }, + if msg.local_features.supports_upfront_shutdown_script() { "supported" } else { "not supported"}, + if msg.local_features.supports_unknown_bits() { "present" } else { "none" }, + if msg.global_features.supports_unknown_bits() { "present" } else { "none" }); + peer.their_global_features = Some(msg.global_features); peer.their_local_features = Some(msg.local_features);