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();
assert_eq!(serialization.message_count, 3);
assert_eq!(serialization.node_announcement_count, 2);
- assert_eq!(serialization.node_update_count, 2);
- assert_eq!(serialization.node_feature_update_count, 2);
- assert_eq!(serialization.node_address_update_count, 2);
+ assert_eq!(serialization.node_update_count, 1);
+ assert_eq!(serialization.node_feature_update_count, 1);
+ assert_eq!(serialization.node_address_update_count, 1);
}
/// If a channel has only seen updates in one direction, it should not be announced