Browse Source

Merge pull request #51 from yuriy0803/egaz-pool

coin etica
master
yuriy0803 3 years ago committed by GitHub
parent
commit
930b79b51c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 6
      api.json
  3. 14
      payouts/unlocker.go
  4. 2
      proxy/miner.go
  5. 2
      storage/redis.go

2
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",

6
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,

14
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
}

2
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" {

2
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)
}

Loading…
Cancel
Save