Skip to content

Commit

Permalink
Filter out spare node mutations.
Browse files Browse the repository at this point in the history
This is a bugfix for when we don't have any data _after_
last_sync_timestamp, in which case that announcement should not be
serialized. However, for the better serialization strategy, we will
then fetch the latest update we've seen, regardless of if it came
prior or after last_sync_timestamp, so this commit is followed by a
rename and that scenario should become inapplicable, it will be
squashed immediately following a concept ACK.
  • Loading branch information
arik-so committed Jun 27, 2024
1 parent 9401960 commit cb5f8e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,17 @@ 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.has_feature_set_changed || delta.has_address_set_changed || delta.last_details_before_seen.is_none()
if delta.latest_details_after_seen.is_none() {
// this entry is vestigial due to the optimized reminder necessity lookup
return false;
}
if delta.last_details_before_seen.is_none() {
// this node is new and needs including
return true;
}
// either something changed, or we're sending a reminder
// consider restricting snapshots that include reminders in the future
delta.has_feature_set_changed || delta.has_address_set_changed || delta.requires_reminder
}).collect();

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

0 comments on commit cb5f8e7

Please sign in to comment.