X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Fgossip.rs;fp=lightning%2Fsrc%2Frouting%2Fgossip.rs;h=6504b590e1095a83f314ed2ce30f8ecde0fbe669;hb=d2a9ae0b8eb5bdb1724be0b8d398d0fdf9870266;hp=e265c6322ec56ad1cb3aee3bae696596d5ff02a5;hpb=a922830ebbea1207d178b455237abe5474598026;p=rust-lightning diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index e265c632..6504b590 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -368,10 +368,12 @@ where C::Target: chain::Access, L::Target: Logger /// to request gossip messages for each channel. The sync is considered complete /// when the final reply_scids_end message is received, though we are not /// tracking this directly. - fn peer_connected(&self, their_node_id: &PublicKey, init_msg: &Init) { + fn peer_connected(&self, their_node_id: &PublicKey, init_msg: &Init) -> Result<(), ()> { // We will only perform a sync with peers that support gossip_queries. if !init_msg.features.supports_gossip_queries() { - return (); + // Don't disconnect peers for not supporting gossip queries. We may wish to have + // channels with peers even without being able to exchange gossip. + return Ok(()); } // The lightning network's gossip sync system is completely broken in numerous ways. @@ -445,6 +447,7 @@ where C::Target: chain::Access, L::Target: Logger timestamp_range: u32::max_value(), }, }); + Ok(()) } fn handle_reply_channel_range(&self, _their_node_id: &PublicKey, _msg: ReplyChannelRange) -> Result<(), LightningError> { @@ -2614,7 +2617,7 @@ mod tests { // It should ignore if gossip_queries feature is not enabled { let init_msg = Init { features: InitFeatures::known().clear_gossip_queries(), remote_network_address: None }; - gossip_sync.peer_connected(&node_id_1, &init_msg); + gossip_sync.peer_connected(&node_id_1, &init_msg).unwrap(); let events = gossip_sync.get_and_clear_pending_msg_events(); assert_eq!(events.len(), 0); } @@ -2622,7 +2625,7 @@ mod tests { // It should send a gossip_timestamp_filter with the correct information { let init_msg = Init { features: InitFeatures::known(), remote_network_address: None }; - gossip_sync.peer_connected(&node_id_1, &init_msg); + gossip_sync.peer_connected(&node_id_1, &init_msg).unwrap(); let events = gossip_sync.get_and_clear_pending_msg_events(); assert_eq!(events.len(), 1); match &events[0] {