From df3f11a337955dd703199cc2b037d4bfb698ceba Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 06:53:00 +0100 Subject: add peer clock skew warning --- src/config/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/config/mod.rs') diff --git a/src/config/mod.rs b/src/config/mod.rs index 37c3ce6..2dfefcf 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -249,6 +249,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ Some("7d"), "Members that renewed their alive stamp within this time vote on remakes (a majority of them must agree). Matters on the node that coordinates a remake.", ), + option( + "clock-skew-warn", + Kind::Duration, + "DURATION", + Some("2s"), + "Warn in the log when this node's clock differs from most of its peers' by more than this, for sure (beyond half the round trip it was measured over, from their PONGs); 0: never.", + ), option( "blob-chunk", Kind::Size, @@ -467,6 +474,11 @@ pub(crate) struct Settings { with = "crate::units::duration_option" )] pub(crate) electorate_window: Duration, + #[serde( + default = "default_clock_skew_warn", + with = "crate::units::duration_option" + )] + pub(crate) clock_skew_warn: Duration, /// In bytes. #[serde(default = "default_blob_chunk", with = "crate::units::size_option")] pub(crate) blob_chunk: u64, @@ -539,6 +551,9 @@ fn default_neighbours() -> usize { fn default_electorate_window() -> Duration { Duration::from_secs(7 * 24 * 3600) } +fn default_clock_skew_warn() -> Duration { + Duration::from_secs(2) +} fn default_blob_chunk() -> u64 { 64 * 1024 } -- cgit v1.3.1