From 208cd2e8dc98ea4cc65c21b2bf58652f0da23615 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 Nov 2024 14:49:22 +0100 Subject: [PATCH] Replaces CheckHistory config of rewarder bot with RelativeHistory with sane default for testnet. --- Tools/TestNetRewarder/Configuration.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tools/TestNetRewarder/Configuration.cs b/Tools/TestNetRewarder/Configuration.cs index 5d6ae51d..84950d4e 100644 --- a/Tools/TestNetRewarder/Configuration.cs +++ b/Tools/TestNetRewarder/Configuration.cs @@ -4,6 +4,8 @@ namespace TestNetRewarder { public class Configuration { + private readonly DateTime AppStartUct = DateTime.UtcNow; + [Uniform("datapath", "dp", "DATAPATH", true, "Root path where all data files will be saved.")] public string DataPath { get; set; } = "datapath"; @@ -16,8 +18,8 @@ namespace TestNetRewarder [Uniform("interval-minutes", "im", "INTERVALMINUTES", true, "time in minutes between reward updates.")] public int IntervalMinutes { get; set; } = 15; - [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; + [Uniform("relative-history", "rh", "RELATIVEHISTORY", false, "Number of seconds into the past (from app start) that checking of chain history will start. Default: 3 hours ago.")] + public int RelativeHistorySeconds { get; set; } = 3600 * 3; [Uniform("market-insights", "mi", "MARKETINSIGHTS", false, "Semi-colon separated integers. Each represents a multiple of intervals, for which a market insights average will be generated.")] public string MarketInsights { get; set; } = "1;96"; @@ -45,8 +47,7 @@ namespace TestNetRewarder { get { - if (CheckHistoryTimestamp == 0) throw new Exception("'check-history' unix timestamp is required. Set it to the start/launch moment of the testnet."); - return DateTimeOffset.FromUnixTimeSeconds(CheckHistoryTimestamp).UtcDateTime; + return AppStartUct - TimeSpan.FromSeconds(RelativeHistorySeconds); } } }