From 18ff977122abb4e8bcbd03efc5961f6ee747c590 Mon Sep 17 00:00:00 2001 From: yuriy0803 Date: Fri, 30 Sep 2022 22:11:18 +0200 Subject: [PATCH] coin etica etica --- README.md | 2 +- api.json | 6 +++--- payouts/unlocker.go | 14 +++++++++----- proxy/miner.go | 2 ++ storage/redis.go | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0e6ce29..bf3d79b 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ otherwise you will get errors on start because of JSON comments.** "name": "main", // shares or (solo "pplns": 0,) "pplns": 9000, - // mordor, classic, ethereum, ropsten or ubiq, callisto + // mordor, classic, ethereum, ropsten or ubiq, callisto, etica "network": "classic", // exchange api coingecko "coin-name":"etc", diff --git a/api.json b/api.json index a3f9672..804a625 100644 --- a/api.json +++ b/api.json @@ -1,10 +1,10 @@ { "threads": 4, - "coin": "etc", + "coin": "etica", "name": "main", "pplns": 9000, - "network": "classic", - "coin-name":"etc", + "network": "etica", + "coin-name":"etica", "proxy": { "enabled": true, diff --git a/payouts/unlocker.go b/payouts/unlocker.go index 446d4bc..7be3ad8 100644 --- a/payouts/unlocker.go +++ b/payouts/unlocker.go @@ -78,6 +78,8 @@ func NewBlockUnlocker(cfg *UnlockerConfig, backend *storage.RedisClient, network cfg.ConstantinopleFBlock = big.NewInt(4230000) } else if network == "callisto" { // nothing needs configuring here, simply proceed. + } else if network == "etica" { + cfg.ConstantinopleFBlock = big.NewInt(0) } else if network == "ubiq" { // nothing needs configuring here, simply proceed. } else { @@ -277,7 +279,7 @@ func (u *BlockUnlocker) handleBlock(block *rpc.GetBlockReply, candidate *storage rewardForUncles := big.NewInt(0).Mul(uncleReward, big.NewInt(int64(len(block.Uncles)))) reward.Add(reward, rewardForUncles) - } else if u.config.Network == "ethereum" || u.config.Network == "ropsten" { + } else if u.config.Network == "ethereum" || u.config.Network == "ropsten" || u.config.Network == "etica" { reward = getConstRewardEthereum(candidate.Height, u.config) // Add reward for including uncles uncleReward := new(big.Int).Div(reward, big32) @@ -317,7 +319,7 @@ func handleUncle(height int64, uncle *rpc.GetBlockReply, candidate *storage.Bloc reward = getUncleRewardUbiq(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardUbiq(height)) } else if cfg.Network == "callisto" { reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardcallisto(height)) - } else if cfg.Network == "ethereum" || cfg.Network == "ropsten" { + } else if cfg.Network == "ethereum" || cfg.Network == "ropsten" || cfg.Network == "etica" { reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardUbiq(height)) } candidate.Height = height @@ -394,6 +396,7 @@ func (u *BlockUnlocker) unlockPendingBlocks() { log.Printf("Failed to calculate rewards for round %v: %v", block.RoundKey(), err) return } + log.Printf("RoundRewards 2 %v", roundRewards) err = u.backend.WriteImmatureBlock(block, roundRewards) if err != nil { u.halt = true @@ -491,6 +494,7 @@ func (u *BlockUnlocker) unlockAndCreditMiners() { totalPoolProfit := new(big.Rat) for _, block := range result.maturedBlocks { + log.Printf("Blocks 2 %v", block) revenue, minersProfit, poolProfit, roundRewards, percents, err := u.calculateRewards(block) if err != nil { u.halt = true @@ -724,9 +728,9 @@ func getConstRewardEthereum(height int64, cfg *UnlockerConfig) *big.Int { // Select the correct block reward based on chain progression blockReward := frontierBlockReward headerNumber := big.NewInt(height) - if cfg.ByzantiumFBlock.Cmp(headerNumber) <= 0 { - blockReward = byzantiumBlockReward - } + //if cfg.ByzantiumFBlock.Cmp(headerNumber) <= 0 { + // blockReward = byzantiumBlockReward + //} if cfg.ConstantinopleFBlock.Cmp(headerNumber) <= 0 { blockReward = constantinopleBlockReward } diff --git a/proxy/miner.go b/proxy/miner.go index ef0d58d..5a40d60 100644 --- a/proxy/miner.go +++ b/proxy/miner.go @@ -23,6 +23,8 @@ func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, param if hasher == nil { if s.config.Network == "classic" { hasher = etchash.New(&ecip1099FBlockClassic, nil) + } else if s.config.Network == "etica" { + hasher = etchash.New(nil, nil) } else if s.config.Network == "mordor" { hasher = etchash.New(&ecip1099FBlockMordor, nil) } else if s.config.Network == "callisto" { diff --git a/storage/redis.go b/storage/redis.go index cc147ac..2513075 100644 --- a/storage/redis.go +++ b/storage/redis.go @@ -606,7 +606,7 @@ func (r *RedisClient) WriteBlock(login, id string, params []string, diff, actual } func (r *RedisClient) writeShare(tx *redis.Multi, ms, ts int64, login, id string, diff int64, actualDiff int64, expire time.Duration) { - times := int(diff / 1000000000) + times := int(diff / 100000000) for i := 0; i < times; i++ { tx.LPush(r.formatKey("lastshares"), login) }