diff --git a/config.example.json b/config.example.json index cad1b09..51c40a7 100644 --- a/config.example.json +++ b/config.example.json @@ -5,6 +5,10 @@ "threads": 2, + "estimationWindow": "15m", + "luckWindow": "24h", + "largeLuckWindow": "72h", + "stratum": { "timeout": "15m", "blockRefreshInterval": "1s", diff --git a/go-pool/pool/pool.go b/go-pool/pool/pool.go index cf3cb2f..6e0b555 100644 --- a/go-pool/pool/pool.go +++ b/go-pool/pool/pool.go @@ -6,6 +6,7 @@ type Config struct { BypassShareValidation bool `json:"bypassShareValidation"` Stratum Stratum `json:"stratum"` Daemon Daemon `json:"daemon"` + EstimationWindow string `json:"estimationWindow"` LuckWindow string `json:"luckWindow"` LargeLuckWindow string `json:"largeLuckWindow"` Threads int `json:"threads"` diff --git a/go-pool/stratum/stratum.go b/go-pool/stratum/stratum.go index a58ed36..524bb6a 100644 --- a/go-pool/stratum/stratum.go +++ b/go-pool/stratum/stratum.go @@ -56,6 +56,14 @@ func NewStratum(cfg *pool.Config) *StratumServer { timeout, _ := time.ParseDuration(cfg.Stratum.Timeout) stratum.timeout = timeout + estimationWindow, _ := time.ParseDuration(cfg.EstimationWindow) + stratum.estimationWindow = estimationWindow + + luckWindow, _ := time.ParseDuration(cfg.LuckWindow) + stratum.luckWindow = int64(luckWindow / time.Millisecond) + luckLargeWindow, _ := time.ParseDuration(cfg.LargeLuckWindow) + stratum.luckLargeWindow = int64(luckLargeWindow / time.Millisecond) + // Init block template stratum.refreshBlockTemplate(false)