From: Arik Sosman Date: Fri, 28 Jun 2024 21:13:05 +0000 (-0400) Subject: Rename latest_details_after_seen to latest_details. X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=86104e585cfb8a8e91aa391ce82c00cb4fb11d08;p=rapid-gossip-sync-server Rename latest_details_after_seen to latest_details. If the latest node details have already been seen by a client, we still need to store them for correctly detecting reminder necessity in the future. --- diff --git a/src/lib.rs b/src/lib.rs index 4da8f38..9b66e73 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,7 +320,7 @@ fn serialize_delta(serialization_details: &SerializationSet, s if node_delta.has_address_set_changed { node_address_update_count += 1; - let address_set = &node_delta.latest_details_after_seen.as_ref().unwrap().addresses; + let address_set = &node_delta.latest_details.as_ref().unwrap().addresses; let mut address_serialization = Vec::new(); // we don't know a priori how many are <= 255 bytes @@ -348,7 +348,7 @@ fn serialize_delta(serialization_details: &SerializationSet, s if node_delta.has_feature_set_changed { node_feature_update_count += 1; - let latest_features = &node_delta.latest_details_after_seen.as_ref().unwrap().features; + let latest_features = &node_delta.latest_details.as_ref().unwrap().features; // are these features among the most common ones? if let Some(index) = serialization_details.node_announcement_feature_defaults.iter().position(|f| f == latest_features) { diff --git a/src/lookup.rs b/src/lookup.rs index 776b1ab..302268b 100644 --- a/src/lookup.rs +++ b/src/lookup.rs @@ -54,7 +54,7 @@ pub(super) struct ChannelDelta { pub(super) struct NodeDelta { /// The most recently received, but new-to-the-client, node details - pub(super) latest_details_after_seen: Option, + pub(super) latest_details: Option, /// Between last_details_before_seen and latest_details_after_seen, including any potential /// intermediate updates that are not kept track of here, has the set of features this node @@ -91,7 +91,7 @@ impl Default for ChannelDelta { impl Default for NodeDelta { fn default() -> Self { Self { - latest_details_after_seen: None, + latest_details: None, has_feature_set_changed: false, has_address_set_changed: false, last_details_before_seen: None, @@ -571,7 +571,7 @@ pub(super) async fn fetch_node_updates(client: &Client, last_sync_time } if !is_previously_processed_node_id { - (*current_node_delta).latest_details_after_seen.get_or_insert(NodeDetails { + (*current_node_delta).latest_details.get_or_insert(NodeDetails { seen: current_seen_timestamp, features: unsigned_node_announcement.features, addresses: address_set, diff --git a/src/serialization.rs b/src/serialization.rs index 5f11b27..a527b45 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -228,7 +228,7 @@ pub(super) fn serialize_delta_set(channel_delta_set: DeltaSet, node_delta_set: N let mut node_feature_histogram: HashMap<&NodeFeatures, usize> = Default::default(); for (_id, delta) in serialization_set.node_mutations.iter() { if delta.has_feature_set_changed || delta.last_details_before_seen.is_none() { - if let Some(latest_details) = delta.latest_details_after_seen.as_ref() { + if let Some(latest_details) = delta.latest_details.as_ref() { *node_feature_histogram.entry(&latest_details.features).or_insert(0) += 1; }; }