From: Arik Sosman Date: Fri, 28 Jun 2024 17:57:48 +0000 (-0400) Subject: Parametrize prune interval. X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=71b734587c3abd115ad63ecd34b70f8a3a97a6c7;p=rapid-gossip-sync-server Parametrize prune interval. Create a config variable representing the time interval whereafter graph data gets pruned. This value should be used to limit lookup time frames. --- diff --git a/src/config.rs b/src/config.rs index 4950ec0..a302fb7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -23,6 +23,10 @@ pub(crate) const MAX_SNAPSHOT_SCOPE: u32 = 3600 * 24 * 21; // three weeks /// updates in both directions. pub(crate) const CHANNEL_REMINDER_AGE: Duration = Duration::from_secs(6 * 24 * 60 * 60); +/// The interval after which graph data gets pruned after it was first seen +/// This should match the LDK default pruning interval, which is 14 days +pub(crate) const PRUNE_INTERVAL: Duration = Duration::from_secs(14 * 24 * 60 * 60); + /// Maximum number of default features to calculate for node announcements pub(crate) const NODE_DEFAULT_FEATURE_COUNT: u8 = 6; diff --git a/src/lookup.rs b/src/lookup.rs index 4337508..776b1ab 100644 --- a/src/lookup.rs +++ b/src/lookup.rs @@ -231,7 +231,7 @@ pub(super) async fn fetch_channel_announcements(delta_set: &mut DeltaS let reminder_threshold_timestamp = current_timestamp.checked_sub(config::CHANNEL_REMINDER_AGE.as_secs()).unwrap() as f64; log_info!(logger, "Fetch first time we saw the current value combination for each direction (prior mutations excepted)"); - let reminder_lookup_threshold_timestamp = current_timestamp.checked_sub(config::CHANNEL_REMINDER_AGE.as_secs() * 3).unwrap() as f64; + let reminder_lookup_threshold_timestamp = current_timestamp.checked_sub(config::PRUNE_INTERVAL.as_secs()).unwrap() as f64; let params: [&(dyn tokio_postgres::types::ToSql + Sync); 2] = [&channel_ids, &reminder_lookup_threshold_timestamp]; /*