From ae8a837e7311290987330aa4c4ffb5b3d51b35d2 Mon Sep 17 00:00:00 2001 From: Sammy Libre Date: Tue, 6 Dec 2016 23:39:39 +0500 Subject: [PATCH] Move blockRefreshInterval setting --- config.example.json | 3 ++- go-pool/pool/pool.go | 6 +++--- go-pool/stratum/stratum.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.example.json b/config.example.json index d9fbf76..48adb0b 100644 --- a/config.example.json +++ b/config.example.json @@ -9,9 +9,10 @@ "luckWindow": "24h", "largeLuckWindow": "72h", + "blockRefreshInterval": "1s", + "stratum": { "timeout": "15m", - "blockRefreshInterval": "1s", "listen": [ { diff --git a/go-pool/pool/pool.go b/go-pool/pool/pool.go index 89d20d6..33b5be6 100644 --- a/go-pool/pool/pool.go +++ b/go-pool/pool/pool.go @@ -5,6 +5,7 @@ type Config struct { BypassAddressValidation bool `json:"bypassAddressValidation"` BypassShareValidation bool `json:"bypassShareValidation"` Stratum Stratum `json:"stratum"` + BlockRefreshInterval string `json:"blockRefreshInterval"` UpstreamCheckInterval string `json:"upstreamCheckInterval"` Upstream []Upstream `json:"upstream"` EstimationWindow string `json:"estimationWindow"` @@ -19,9 +20,8 @@ type Config struct { } type Stratum struct { - Timeout string `json:"timeout"` - BlockRefreshInterval string `json:"blockRefreshInterval"` - Ports []Port `json:"listen"` + Timeout string `json:"timeout"` + Ports []Port `json:"listen"` } type Port struct { diff --git a/go-pool/stratum/stratum.go b/go-pool/stratum/stratum.go index 0151e43..91167fc 100644 --- a/go-pool/stratum/stratum.go +++ b/go-pool/stratum/stratum.go @@ -80,7 +80,7 @@ func NewStratum(cfg *pool.Config) *StratumServer { // Init block template stratum.refreshBlockTemplate(false) - refreshIntv, _ := time.ParseDuration(cfg.Stratum.BlockRefreshInterval) + refreshIntv, _ := time.ParseDuration(cfg.BlockRefreshInterval) refreshTimer := time.NewTimer(refreshIntv) log.Printf("Set block refresh every %v", refreshIntv)