]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Include old updates when necessary.
authorArik Sosman <git@arik.io>
Sat, 4 Nov 2023 06:05:26 +0000 (23:05 -0700)
committerArik Sosman <git@arik.io>
Sat, 4 Nov 2023 06:06:11 +0000 (23:06 -0700)
When a channel has only recently become bidirectional,
but there has not been a new update in the old direction
since the last sync, the latest update in the old direction
must still be included in full because it is the first time
the full channel is being snapshotted.

src/serialization.rs

index 93bd381d39e4b2291b54061c0f9913cc7ae39eb8..7e58b02e5d587a8a2e63a3e41712ac67feb17770 100644 (file)
@@ -187,6 +187,10 @@ pub(super) fn serialize_delta_set(delta_set: DeltaSet, last_sync_timestamp: u32)
                                                record_full_update_in_histograms(&latest_update);
                                                serialization_set.updates.push(UpdateSerialization::Full(latest_update));
                                        }
+                               } else if is_newly_included_announcement {
+                                       if let Some(unannounced_update) = updates.last_update_before_seen {
+                                               serialization_set.updates.push(UpdateSerialization::Full(unannounced_update.update));
+                                       }
                                } else if let Some(flags) = updates.serialization_update_flags {
                                        serialization_set.updates.push(UpdateSerialization::Reminder(scid, flags));
                                }