diff --git a/engine/factomd.go b/engine/factomd.go index 963fd0410a..8b4cab6581 100644 --- a/engine/factomd.go +++ b/engine/factomd.go @@ -59,7 +59,12 @@ func Factomd(params *FactomParams, listenToStdin bool) interfaces.IState { state0.FactomNodeName = state0.Prefix + "FNode0" state0.TimestampAtBoot = primitives.NewTimestampNow() state0.SetLeaderTimestamp(state0.TimestampAtBoot) - state0.SetMessageFilterTimestamp(state0.TimestampAtBoot) + + // build a timestamp 20 minutes before boot so we will accept messages from nodes who booted before us. + preBootTime := new(primitives.Timestamp) + preBootTime.SetTimeMilli(state0.TimestampAtBoot.GetTimeMilli() - 20*60*1000) + state0.SetMessageFilterTimestamp(preBootTime) + state0.EFactory = new(electionMsgs.ElectionsFactory) NetStart(state0, params, listenToStdin) diff --git a/state/state.go b/state/state.go index 4888c87c01..ca5bfeaef2 100644 --- a/state/state.go +++ b/state/state.go @@ -2236,7 +2236,7 @@ func (s *State) GetMessageFilterTimestamp() interfaces.Timestamp { } // the MessageFilterTimestamp is used to filter messages from the past or before the replay filter. -// We will not set it to a time that is before boot or more than one hour in the past. +// We will not set it to a time that is before (20 minutes before) boot or more than one hour in the past. // this ensure messages from prior boot and messages that predate the current replay filter are // are dropped. // It marks the start of the replay filter content @@ -2253,8 +2253,12 @@ func (s *State) SetMessageFilterTimestamp(leaderTS interfaces.Timestamp) { requestedTS.SetTimestamp(onehourago) } - if requestedTS.GetTimeMilli() < s.TimestampAtBoot.GetTimeMilli() { - requestedTS.SetTimestamp(s.TimestampAtBoot) + // build a timestamp 20 minutes before boot so we will accept messages from nodes who booted before us. + preBootTime := new(primitives.Timestamp) + preBootTime.SetTimeMilli(s.TimestampAtBoot.GetTimeMilli() - 20*60*1000) + + if requestedTS.GetTimeMilli() < preBootTime.GetTimeMilli() { + requestedTS.SetTimestamp(preBootTime) } if s.MessageFilterTimestamp != nil && requestedTS.GetTimeMilli() < s.MessageFilterTimestamp.GetTimeMilli() {