Browse Source

Make first block refresh after timers set

pool
Sammy Libre 8 years ago
parent
commit
46137b5923
  1. 6
      go-pool/stratum/stratum.go

6
go-pool/stratum/stratum.go

@ -86,9 +86,6 @@ func NewStratum(cfg *pool.Config) *StratumServer {
luckLargeWindow, _ := time.ParseDuration(cfg.LargeLuckWindow) luckLargeWindow, _ := time.ParseDuration(cfg.LargeLuckWindow)
stratum.luckLargeWindow = int64(luckLargeWindow / time.Millisecond) stratum.luckLargeWindow = int64(luckLargeWindow / time.Millisecond)
// Init block template
stratum.refreshBlockTemplate(false)
refreshIntv, _ := time.ParseDuration(cfg.BlockRefreshInterval) refreshIntv, _ := time.ParseDuration(cfg.BlockRefreshInterval)
refreshTimer := time.NewTimer(refreshIntv) refreshTimer := time.NewTimer(refreshIntv)
log.Printf("Set block refresh every %v", refreshIntv) log.Printf("Set block refresh every %v", refreshIntv)
@ -96,6 +93,9 @@ func NewStratum(cfg *pool.Config) *StratumServer {
checkIntv, _ := time.ParseDuration(cfg.UpstreamCheckInterval) checkIntv, _ := time.ParseDuration(cfg.UpstreamCheckInterval)
checkTimer := time.NewTimer(checkIntv) checkTimer := time.NewTimer(checkIntv)
// Init block template
stratum.refreshBlockTemplate(false)
go func() { go func() {
for { for {
select { select {

Loading…
Cancel
Save