From 0ac9345665cb465a3ba33acf513969b16babdd72 Mon Sep 17 00:00:00 2001 From: Arik Sosman Date: Wed, 16 Aug 2023 21:50:43 -0700 Subject: [PATCH] Send full updates whenever the channel announcement is sent. --- src/serialization.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serialization.rs b/src/serialization.rs index 4c1d828..86e114b 100644 --- a/src/serialization.rs +++ b/src/serialization.rs @@ -140,12 +140,12 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32) let current_announcement_seen = channel_announcement_delta.seen; let is_new_announcement = current_announcement_seen >= last_sync_timestamp; - let is_newly_updated_announcement = if let Some(first_update_seen) = channel_delta.first_bidirectional_updates_seen { + let is_newly_included_announcement = if let Some(first_update_seen) = channel_delta.first_bidirectional_updates_seen { first_update_seen >= last_sync_timestamp } else { false }; - let send_announcement = is_new_announcement || is_newly_updated_announcement; + let send_announcement = is_new_announcement || is_newly_included_announcement; if send_announcement { serialization_set.latest_seen = max(serialization_set.latest_seen, current_announcement_seen); serialization_set.announcements.push(channel_delta.announcement.unwrap().announcement); @@ -166,7 +166,7 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32) if updates.last_update_before_seen.is_some() { let mutated_properties = updates.mutated_properties; - if mutated_properties.len() == 5 { + if mutated_properties.len() == 5 || send_announcement { // all five values have changed, it makes more sense to just // serialize the update as a full update instead of as a change // this way, the default values can be computed more efficiently -- 2.39.5