From: bmancini55 Date: Fri, 19 Feb 2021 21:56:48 +0000 (-0500) Subject: Add SendReplyChannelRange message event X-Git-Tag: v0.0.14~48^2~10 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=feca062072de1df83fe0b61262173d61f611df19;p=rust-lightning Add SendReplyChannelRange message event Creates a MessageSendEvent for sending a reply_channel_range message. This event will be fired when handling inbound query_channel_range messages in the NetGraphMessageHandler. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index b56ce5d9d..3109b8529 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -3499,6 +3499,7 @@ impl true, &events::MessageSendEvent::SendChannelRangeQuery { .. } => false, &events::MessageSendEvent::SendShortIdsQuery { .. } => false, + &events::MessageSendEvent::SendReplyChannelRange { .. } => false, } }); } diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index d37476327..dacae671a 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1281,6 +1281,17 @@ impl PeerManager { + log_trace!(self.logger, "Handling SendReplyChannelRange event in peer_handler for node {} with num_scids={} first_blocknum={} number_of_blocks={}, sync_complete={}", + log_pubkey!(node_id), + msg.short_channel_ids.len(), + msg.first_blocknum, + msg.number_of_blocks, + msg.sync_complete); + let (mut descriptor, peer) = get_peer_for_forwarding!(node_id, {}); + peer.pending_outbound_buffer.push_back(peer.channel_encryptor.encrypt_message(&encode_msg!(msg))); + self.do_attempt_write_data(&mut descriptor, peer); + } } } diff --git a/lightning/src/util/events.rs b/lightning/src/util/events.rs index 6f6f32dae..1021ebb39 100644 --- a/lightning/src/util/events.rs +++ b/lightning/src/util/events.rs @@ -362,6 +362,14 @@ pub enum MessageSendEvent { /// The query_short_channel_ids which should be sent. msg: msgs::QueryShortChannelIds, }, + /// Sends a reply to a channel range query. This may be one of several events + /// emitted during processing of the query. + SendReplyChannelRange { + /// The node_id of this message recipient + node_id: PublicKey, + /// The reply_channel_range which should be sent. + msg: msgs::ReplyChannelRange, + } } /// A trait indicating an object may generate message send events