]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Rename latest_details_after_seen to latest_details.
authorArik Sosman <git@arik.io>
Fri, 28 Jun 2024 21:13:05 +0000 (17:13 -0400)
committerArik Sosman <git@arik.io>
Wed, 28 Aug 2024 17:38:30 +0000 (10:38 -0700)
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.

src/lib.rs
src/lookup.rs
src/serialization.rs

index 4da8f38ce1a0e6e5535ea51ae65dd12585a43bda..9b66e7354d4dfb6b49720bb974b794f742855ba4 100644 (file)
@@ -320,7 +320,7 @@ fn serialize_delta<L: Deref + Clone>(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<L: Deref + Clone>(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) {
index 776b1ab0420010cf3cd438090b79a0445400c104..302268b0057c9846ec075595c58e44d334d1b0c5 100644 (file)
@@ -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<NodeDetails>,
+       pub(super) latest_details: Option<NodeDetails>,
 
        /// 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<L: Deref>(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,
index 5f11b275f6799f3f61baa88d6825645a9dde89cc..a527b45c824b3202d5501693ae7f5d520175f6e1 100644 (file)
@@ -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;
                        };
                }