]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add SendReplyChannelRange message event
authorbmancini55 <bmancini@gmail.com>
Fri, 19 Feb 2021 21:56:48 +0000 (16:56 -0500)
committerbmancini55 <bmancini@gmail.com>
Fri, 5 Mar 2021 20:09:42 +0000 (15:09 -0500)
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.

lightning/src/ln/channelmanager.rs
lightning/src/ln/peer_handler.rs
lightning/src/util/events.rs

index b56ce5d9d052aa38c955d172e498d6cde4260713..3109b8529057661cdafa06383d967ead3ac923b4 100644 (file)
@@ -3499,6 +3499,7 @@ impl<Signer: Sign, M: Deref + Sync + Send, T: Deref + Sync + Send, K: Deref + Sy
                                        &events::MessageSendEvent::PaymentFailureNetworkUpdate { .. } => true,
                                        &events::MessageSendEvent::SendChannelRangeQuery { .. } => false,
                                        &events::MessageSendEvent::SendShortIdsQuery { .. } => false,
+                                       &events::MessageSendEvent::SendReplyChannelRange { .. } => false,
                                }
                        });
                }
index d37476327ba02750a34f2fa0e8a8bce0dc62a167..dacae671aaac028663ff5f2aa973f9ef81607faa 100644 (file)
@@ -1281,6 +1281,17 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
                                                peer.pending_outbound_buffer.push_back(peer.channel_encryptor.encrypt_message(&encode_msg!(msg)));
                                                self.do_attempt_write_data(&mut descriptor, peer);
                                        }
+                                       MessageSendEvent::SendReplyChannelRange { ref node_id, ref msg } => {
+                                               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);
+                                       }
                                }
                        }
 
index 6f6f32daeab18226313872d1b5ae15fbd3bfa038..1021ebb399a887a15353cb8c05c1e3686db62c18 100644 (file)
@@ -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