Merge pull request #77 from arik-so/static-channel-reminders
[rapid-gossip-sync-server] / src / snapshot.rs
index 07427a6c6d94d7f69fd24d5d90bf70898191463f..c5154c791f9e072a67f3ee52ea2babc89a6abaf4 100644 (file)
@@ -70,8 +70,9 @@ impl<L: Deref + Clone> Snapshotter<L> where L::Target: Logger {
                let relative_symlink_to_snapshot_path = "../snapshots";
 
                // 1. get the current timestamp
-               let snapshot_generation_timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs();
-               let reference_timestamp = Self::round_down_to_nearest_multiple(snapshot_generation_timestamp, snapshot_interval as u64);
+               let snapshot_generation_time = SystemTime::now();
+               let snapshot_generation_timestamp = snapshot_generation_time.duration_since(UNIX_EPOCH).unwrap().as_secs();
+               let reference_timestamp = Self::round_down_to_nearest_multiple(snapshot_generation_timestamp, snapshot_interval);
                log_info!(self.logger, "Capturing snapshots at {} for: {}", snapshot_generation_timestamp, reference_timestamp);
 
                // 2. sleep until the next round interval
@@ -113,7 +114,7 @@ impl<L: Deref + Clone> Snapshotter<L> where L::Target: Logger {
                        {
                                log_info!(self.logger, "Calculating {}-second snapshot", current_scope);
                                // calculate the snapshot
-                               let snapshot = super::serialize_delta(network_graph_clone, current_last_sync_timestamp.clone() as u32, self.logger.clone()).await;
+                               let snapshot = super::serialize_delta(network_graph_clone, current_last_sync_timestamp.clone() as u32, Some(reference_timestamp), self.logger.clone()).await;
 
                                // persist the snapshot and update the symlink
                                let snapshot_filename = format!("snapshot__calculated-at:{}__range:{}-scope__previous-sync:{}.lngossip", reference_timestamp, current_scope, current_last_sync_timestamp);