diff --git a/api.json b/api.json index 98953ae..425d90e 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, @@ -94,7 +94,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 b4a4381..bf10c9e 100644 --- a/proxy/blocks.go +++ b/proxy/blocks.go @@ -7,8 +7,8 @@ import ( "strings" "sync" - "github.com/ubiq/go-ubiq/common" - //"github.com/ethereum/go-ethereum/common" false + //"github.com/ubiq/go-ubiq/common" false + "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 8714f31..936e2f1 100644 --- a/proxy/miner.go +++ b/proxy/miner.go @@ -6,14 +6,34 @@ import ( "strconv" "strings" - "github.com/ubiq/go-ubiq/common" - "github.com/ubiq/ubqhash" + "github.com/etclabscore/go-etchash" + "github.com/ethereum/go-ethereum/common" ) -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]