Move initial_routing_sync decision to the Router
[rust-lightning] / lightning / src / ln / msgs.rs
index 70bf19f41e0b337dda57b9ca94c02b3b2f8005b8..519c56542ba491856329319c9df6bd231ba88ed2 100644 (file)
@@ -56,7 +56,10 @@ pub enum DecodeError {
 
 /// An init message to be sent or received from a peer
 pub struct Init {
+       #[cfg(not(feature = "fuzztarget"))]
        pub(crate) features: InitFeatures,
+       #[cfg(feature = "fuzztarget")]
+       pub features: InitFeatures,
 }
 
 /// An error message to be sent or received from a peer
@@ -139,9 +142,10 @@ pub struct FundingSigned {
 
 /// A funding_locked message to be sent or received from a peer
 #[derive(Clone, PartialEq)]
+#[allow(missing_docs)]
 pub struct FundingLocked {
-       pub(crate) channel_id: [u8; 32],
-       pub(crate) next_per_commitment_point: PublicKey,
+       pub channel_id: [u8; 32],
+       pub next_per_commitment_point: PublicKey,
 }
 
 /// A shutdown message to be sent or received from a peer
@@ -570,7 +574,7 @@ pub trait ChannelMessageHandler : events::MessageSendEventsProvider + Send + Syn
        fn peer_disconnected(&self, their_node_id: &PublicKey, no_connection_possible: bool);
 
        /// Handle a peer reconnecting, possibly generating channel_reestablish message(s).
-       fn peer_connected(&self, their_node_id: &PublicKey);
+       fn peer_connected(&self, their_node_id: &PublicKey, msg: &Init);
        /// Handle an incoming channel_reestablish message from the given peer.
        fn handle_channel_reestablish(&self, their_node_id: &PublicKey, msg: &ChannelReestablish);
 
@@ -600,6 +604,8 @@ pub trait RoutingMessageHandler : Send + Sync {
        /// starting at the node *after* the provided publickey and including batch_amount entries.
        /// If None is provided for starting_point, we start at the first node.
        fn get_next_node_announcements(&self, starting_point: Option<&PublicKey>, batch_amount: u8) -> Vec<NodeAnnouncement>;
+       /// Returns whether a full sync should be requested from a peer.
+       fn should_request_full_sync(&self, node_id: &PublicKey) -> bool;
 }
 
 pub(crate) struct OnionRealm0HopData {