diff --git a/config/config.example.json b/config/config.example.json index bb57036..3b631e5 100644 --- a/config/config.example.json +++ b/config/config.example.json @@ -71,16 +71,20 @@ "upstreamCheckInterval": "5s", "upstream": [ { - "name": "prime", + "context": "prime", "url": "ws://127.0.0.1:8547", "timeout": "10s" }, { - "name": "region", + "context": "region", + "name": "", + "url": "", "timeout": "10s" }, { - "name": "zone", + "context": "zone", + "name": "", + "url": "", "timeout": "10s" } ], diff --git a/main.go b/main.go index 2f324d0..3b10b76 100644 --- a/main.go +++ b/main.go @@ -74,9 +74,11 @@ func readConfig(cfg *proxy.Config) { cfg.Upstream[common.PRIME_CTX].Url = "ws://127.0.0.1:" + returnPortHelper(*primePort) } if regionPort != nil && *regionPort != "" { + cfg.Upstream[common.REGION_CTX].Name = *regionPort cfg.Upstream[common.REGION_CTX].Url = "ws://127.0.0.1:" + returnPortHelper(*regionPort) } if zonePort != nil && *zonePort != "" { + cfg.Upstream[common.ZONE_CTX].Name = *zonePort cfg.Upstream[common.ZONE_CTX].Url = "ws://127.0.0.1:" + returnPortHelper(*zonePort) } if *stratumPort != -1 { diff --git a/proxy/proxy.go b/proxy/proxy.go index d812256..5e7df4e 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -320,7 +320,7 @@ func (s *ProxyServer) updateBlockTemplate(pendingHeader *types.Header) { s.blockTemplate.Store(&newTemplate) s.headerCache.Add(newTemplate.JobID, newTemplate.Header) - log.Printf("New block to mine on %s at height %d", common.OrderToString(common.ZONE_CTX), pendingHeader.NumberArray()) + log.Printf("New block to mine on %s at height %d", s.config.Upstream[common.ZONE_CTX].Name, pendingHeader.NumberArray()) difficultyMh := strconv.FormatUint(newTemplate.Header.Difficulty().Uint64() / 1000000, 10) if len(difficultyMh) >= 3 { @@ -334,7 +334,7 @@ func (s *ProxyServer) updateBlockTemplate(pendingHeader *types.Header) { func (s *ProxyServer) verifyMinedHeader(jobID uint, nonce []byte) (*types.Header, error) { header, ok := s.headerCache.Get(jobID) if !ok { - return nil, fmt.Errorf("Unable to find header for that jobID: %d", jobID) + return nil, fmt.Errorf("unable to find header for that jobID: %d", jobID) } header = types.CopyHeader(header) @@ -347,7 +347,7 @@ func (s *ProxyServer) verifyMinedHeader(jobID uint, nonce []byte) (*types.Header } powHash, err := s.engine.VerifySeal(header) - log.Printf("Miner submitted a block. Number: %d. Blockhash: %#x", header.NumberU64(common.ZONE_CTX), header.Hash()) + log.Printf("Miner submitted a block. Location: %s. Number: %d. Blockhash: %#x", s.config.Upstream[common.ZONE_CTX].Name, header.NumberU64(common.ZONE_CTX), header.Hash()) if err != nil { return nil, fmt.Errorf("unable to verify seal of block: %#x. %v", powHash, err) }