X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=85f3026eafa7930d705b9d7cc1b1b8fed3517b39;hb=1da1ffa04b7e7b5bb7c19fb9109bfd6c62f5a612;hp=be5be241ec1b60343d3bd54aec0e35a49b309612;hpb=107da97cd03803fdd1f61501b05e96260ed19016;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index be5be241..85f3026e 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -302,6 +302,9 @@ impl NetAddress { &NetAddress::OnionV3 { .. } => { 37 }, } } + + /// The maximum length of any address descriptor, not including the 1-byte type + pub(crate) const MAX_LEN: u16 = 37; } impl Writeable for NetAddress { @@ -597,10 +600,11 @@ pub trait RoutingMessageHandler : Send + Sync { fn handle_htlc_fail_channel_update(&self, update: &HTLCFailChannelUpdate); /// Gets a subset of the channel announcements and updates required to dump our routing table /// to a remote node, starting at the short_channel_id indicated by starting_point and - /// including batch_amount entries. - fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(ChannelAnnouncement, ChannelUpdate, ChannelUpdate)>; + /// including the batch_amount entries immediately higher in numerical value than starting_point. + fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(ChannelAnnouncement, Option, Option)>; /// Gets a subset of the node announcements required to dump our routing table to a remote node, - /// starting at the node *after* the provided publickey and including batch_amount entries. + /// starting at the node *after* the provided publickey and including batch_amount entries + /// immediately higher (as defined by ::cmp) than starting_point. /// 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; /// Returns whether a full sync should be requested from a peer. @@ -1291,7 +1295,7 @@ impl Readable for UnsignedNodeAnnouncement { impl_writeable_len_match!(NodeAnnouncement, { { NodeAnnouncement { contents: UnsignedNodeAnnouncement { ref features, ref addresses, ref excess_address_data, ref excess_data, ..}, .. }, - 64 + 76 + features.byte_count() + addresses.len()*38 + excess_address_data.len() + excess_data.len() } + 64 + 76 + features.byte_count() + addresses.len()*(NetAddress::MAX_LEN as usize + 1) + excess_address_data.len() + excess_data.len() } }, { signature, contents