diff --git a/ProjectPlugins/CodexContractsPlugin/CodexContractsAccess.cs b/ProjectPlugins/CodexContractsPlugin/CodexContractsAccess.cs index d6ba837..e4222d4 100644 --- a/ProjectPlugins/CodexContractsPlugin/CodexContractsAccess.cs +++ b/ProjectPlugins/CodexContractsPlugin/CodexContractsAccess.cs @@ -21,6 +21,7 @@ namespace CodexContractsPlugin Request[] GetStorageRequests(TimeRange range); EthAddress GetSlotHost(Request storageRequest, decimal slotIndex); + // add 'RequestFulfilled' to see request is started. SlotFilledEventDTO[] GetSlotFilledEvents(TimeRange timeRange); SlotFreedEventDTO[] GetSlotFreedEvents(TimeRange timeRange); } diff --git a/TestNetRewarder/Configuration.cs b/TestNetRewarder/Configuration.cs index cb9f95d..02401d2 100644 --- a/TestNetRewarder/Configuration.cs +++ b/TestNetRewarder/Configuration.cs @@ -16,7 +16,7 @@ namespace TestNetRewarder [Uniform("interval-minutes", "im", "INTERVALMINUTES", false, "time in minutes between reward updates. (default 15)")] public int Interval { get; set; } = 15; - [Uniform("check-history", "ch", "CHECKHISTORY", false, "if not 0, Unix epoc timestamp of a moment in history on which processing should begin. (default 0)")] + [Uniform("check-history", "ch", "CHECKHISTORY", true, "Unix epoc timestamp of a moment in history on which processing begins. Required for hosting rewards. Should be 'launch of the testnet'.")] public int CheckHistoryTimestamp { get; set; } = 0; public string LogPath diff --git a/TestNetRewarder/TimeSegmenter.cs b/TestNetRewarder/TimeSegmenter.cs index 3608c79..a9ad71a 100644 --- a/TestNetRewarder/TimeSegmenter.cs +++ b/TestNetRewarder/TimeSegmenter.cs @@ -14,15 +14,10 @@ namespace TestNetRewarder this.log = log; if (configuration.Interval < 0) configuration.Interval = 15; + if (configuration.CheckHistoryTimestamp == 0) throw new Exception("'check-history' unix timestamp is required. Set it to the start/launch moment of the testnet."); + segmentSize = TimeSpan.FromSeconds(configuration.Interval); - if (configuration.CheckHistoryTimestamp != 0) - { - start = DateTimeOffset.FromUnixTimeSeconds(configuration.CheckHistoryTimestamp).UtcDateTime; - } - else - { - start = DateTime.UtcNow - segmentSize; - } + start = DateTimeOffset.FromUnixTimeSeconds(configuration.CheckHistoryTimestamp).UtcDateTime; log.Log("Starting time segments at " + start); log.Log("Segment size: " + Time.FormatDuration(segmentSize)); @@ -32,16 +27,21 @@ namespace TestNetRewarder { var now = DateTime.UtcNow; var end = start + segmentSize; + var waited = false; if (end > now) { // Wait for the entire time segment to be in the past. var delay = (end - now).Add(TimeSpan.FromSeconds(3)); + waited = true; await Task.Delay(delay, Program.CancellationToken); } if (Program.CancellationToken.IsCancellationRequested) return; - log.Log($"Time segment {start} to {end}"); + var postfix = "(Catching up...)"; + if (waited) postfix = "(Real-time)"; + + log.Log($"Time segment [{start} to {end}] {postfix}"); var range = new TimeRange(start, end); start = end;