Skip to content

Commit

Permalink
Send full node announcements following old pre-sync updates.
Browse files Browse the repository at this point in the history
This covers the following part of our serialization logic:

If the pre-sync update was more than 6 days ago, serialize in full.
  • Loading branch information
arik-so committed Jul 10, 2024
1 parent 79b7e22 commit 92d9699
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,20 @@ pub(super) fn serialize_delta_set(channel_delta_set: DeltaSet, node_delta_set: N

serialization_set.full_update_defaults = default_update_values;

serialization_set.node_mutations = node_delta_set.into_iter().filter(|(_id, delta)| {
// either something changed, or this node is new
delta.strategy.is_some()
serialization_set.node_mutations = node_delta_set.into_iter().filter_map(|(id, mut delta)| {
if delta.strategy.is_none() {
return None;
}
if let Some(last_details_before_seen) = delta.last_details_before_seen.as_ref() {
if let Some(last_details_seen) = last_details_before_seen.seen {
if last_details_seen <= non_incremental_previous_update_threshold_timestamp {
delta.strategy = Some(NodeSerializationStrategy::Full)
}
}
Some((id, delta))
} else {
None
}
}).collect();

let mut node_feature_histogram: HashMap<&NodeFeatures, usize> = Default::default();
Expand Down

0 comments on commit 92d9699

Please sign in to comment.