From c1b8d3169345318837af12142a5b527b2852edb7 Mon Sep 17 00:00:00 2001 From: yuriy0803 Date: Tue, 30 Aug 2022 17:58:35 +0200 Subject: [PATCH] go to etc-pool --- api.json | 8 ++++---- proxy/blocks.go | 2 +- proxy/miner.go | 28 +++++++++++++++++++++++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/api.json b/api.json index 5f6be5f..860a645 100644 --- a/api.json +++ b/api.json @@ -1,10 +1,10 @@ { "threads": 4, - "coin": "ubiq", + "coin": "etc", "name": "main", "pplns": 9000, - "network": "ubiq", - "coin-name":"ubq", + "network": "classic", + "coin-name":"etc", "proxy": { "enabled": true, @@ -98,7 +98,7 @@ "exchange": { "enabled": true, - "url": "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ubiq", + "url": "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ethereum-classic", "timeout": "50s", "refreshInterval": "900s" }, diff --git a/proxy/blocks.go b/proxy/blocks.go index c71aefd..936eedd 100644 --- a/proxy/blocks.go +++ b/proxy/blocks.go @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/ubiq/go-ubiq/common" + "github.com/ethereum/go-ethereum/common" "github.com/yuriy0803/open-etc-pool-friends/rpc" "github.com/yuriy0803/open-etc-pool-friends/util" ) diff --git a/proxy/miner.go b/proxy/miner.go index 878ac65..3e47a9d 100644 --- a/proxy/miner.go +++ b/proxy/miner.go @@ -6,14 +6,36 @@ import ( "strconv" "strings" - "github.com/ubiq/go-ubiq/common" - "github.com/yuriy0803/ubqhash" + "github.com/ethereum/go-ethereum/common" + "github.com/yuriy0803/etchash" ) -var hasher = ubqhash.New() +var ( + maxUint256 = new(big.Int).Exp(big.NewInt(2), big.NewInt(256), big.NewInt(0)) + ecip1099FBlockClassic uint64 = 11700000 // classic mainnet + ecip1099FBlockMordor uint64 = 2520000 // mordor + uip1FEpoch uint64 = 22 // ubiq mainnet + hasher *etchash.Etchash = nil +) func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, params []string) (bool, bool) { + if hasher == nil { + if s.config.Network == "classic" { + hasher = etchash.New(&ecip1099FBlockClassic, nil) + } else if s.config.Network == "mordor" { + hasher = etchash.New(&ecip1099FBlockMordor, nil) + } else if s.config.Network == "ubiq" { + hasher = etchash.New(nil, &uip1FEpoch) + } else if s.config.Network == "ethereum" || s.config.Network == "ropsten" { + hasher = etchash.New(nil, nil) + } else { + // unknown network + log.Printf("Unknown network configuration %s", s.config.Network) + return false, false + } + } + nonceHex := params[0] hashNoNonce := params[1] mixDigest := params[2]