Skip to content

Commit

Permalink
Only start listening to miners after getting block template
Browse files Browse the repository at this point in the history
  • Loading branch information
Djadih committed Jan 17, 2024
1 parent 44f6d04 commit 0b29480
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ func NewProxy(cfg *Config, backend *storage.RedisClient) *ProxyServer {

proxy.rng = rand.New(rand.NewSource(time.Now().UnixNano()))

if cfg.Proxy.Stratum.Enabled {
proxy.sessions = make(map[*Session]struct{})
go proxy.ListenTCP()
}

proxy.hashrateExpiration = util.MustParseDuration(cfg.Proxy.HashrateExpiration)

refreshIntv := util.MustParseDuration(cfg.Proxy.BlockRefreshInterval)
Expand All @@ -119,6 +114,11 @@ func NewProxy(cfg *Config, backend *storage.RedisClient) *ProxyServer {
stateUpdateTimer := time.NewTimer(stateUpdateIntv)
proxy.fetchBlockTemplate()

if cfg.Proxy.Stratum.Enabled {
proxy.sessions = make(map[*Session]struct{})
go proxy.ListenTCP()
}

go func() {
for {
select {
Expand Down

0 comments on commit 0b29480

Please sign in to comment.