X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=lightning%2Fsrc%2Fln%2Fpeer_handler.rs;h=11c6c4d4c2da29d05206c6fea5548d57f1d914c7;hb=b5723c7d4837a26156ac22672e62aa2c955b95ba;hp=51a546de60b24c6926c36be422679a6826c32122;hpb=9098240e341cf09578819cdf1d2950303478b137;p=rust-lightning diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 51a546de..11c6c4d4 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -3,7 +3,7 @@ //! Instead of actually servicing sockets ourselves we require that you implement the //! SocketDescriptor interface and use that to receive actions which you should perform on the //! socket, and call into PeerManager with bytes read from the socket. The PeerManager will then -//! call into the provided message handlers (probably a ChannelManager and Router) with messages +//! call into the provided message handlers (probably a ChannelManager and NetGraphmsgHandler) with messages //! they should handle, and encoding/sending response messages. use bitcoin::secp256k1::key::{SecretKey,PublicKey}; @@ -36,7 +36,7 @@ pub struct MessageHandler where CM::Target: msgs::ChannelMessageHandl /// ChannelManager object. pub chan_handler: CM, /// A message handler which handles messages updating our knowledge of the network channel - /// graph. Usually this is just a Router object. + /// graph. Usually this is just a NetGraphMsgHandlerMonitor object. pub route_handler: Arc, } @@ -629,10 +629,11 @@ impl PeerManager where 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: {}", + log_info!(self, "Received peer Init message: data_loss_protect: {}, initial_routing_sync: {}, upfront_shutdown_script: {}, static_remote_key: {}, unkown local flags: {}, unknown global flags: {}", if msg.features.supports_data_loss_protect() { "supported" } else { "not supported"}, if msg.features.initial_routing_sync() { "requested" } else { "not requested" }, if msg.features.supports_upfront_shutdown_script() { "supported" } else { "not supported"}, + if msg.features.supports_static_remote_key() { "supported" } else { "not supported"}, if msg.features.supports_unknown_bits() { "present" } else { "none" }, if msg.features.supports_unknown_bits() { "present" } else { "none" }); @@ -640,6 +641,10 @@ impl PeerManager where peer.sync_status = InitSyncTracker::ChannelsSyncing(0); peers.peers_needing_send.insert(peer_descriptor.clone()); } + if !msg.features.supports_static_remote_key() { + log_debug!(self, "Peer {} does not support static remote key, disconnecting with no_connection_possible", log_pubkey!(peer.their_node_id.unwrap())); + return Err(PeerHandleError{ no_connection_possible: true }); + } if !peer.outbound { let mut features = InitFeatures::known();