Browse Source

update

master
yuriy0803 3 years ago
parent
commit
8841c941b8
  1. 6
      api.json
  2. 14
      payouts/unlocker.go
  3. 2
      proxy/miner.go
  4. 2
      storage/redis.go

6
api.json

@ -1,10 +1,10 @@
{ {
"threads": 4, "threads": 4,
"coin": "etica", "coin": "etc",
"name": "main", "name": "main",
"pplns": 9000, "pplns": 9000,
"network": "etica", "network": "classic",
"coin-name":"etica", "coin-name":"etc",
"proxy": { "proxy": {
"enabled": true, "enabled": true,

14
payouts/unlocker.go

@ -78,8 +78,6 @@ func NewBlockUnlocker(cfg *UnlockerConfig, backend *storage.RedisClient, network
cfg.ConstantinopleFBlock = big.NewInt(4230000) cfg.ConstantinopleFBlock = big.NewInt(4230000)
} else if network == "callisto" { } else if network == "callisto" {
// nothing needs configuring here, simply proceed. // nothing needs configuring here, simply proceed.
} else if network == "etica" {
cfg.ConstantinopleFBlock = big.NewInt(0)
} else if network == "ubiq" { } else if network == "ubiq" {
// nothing needs configuring here, simply proceed. // nothing needs configuring here, simply proceed.
} else { } else {
@ -279,7 +277,7 @@ func (u *BlockUnlocker) handleBlock(block *rpc.GetBlockReply, candidate *storage
rewardForUncles := big.NewInt(0).Mul(uncleReward, big.NewInt(int64(len(block.Uncles)))) rewardForUncles := big.NewInt(0).Mul(uncleReward, big.NewInt(int64(len(block.Uncles))))
reward.Add(reward, rewardForUncles) reward.Add(reward, rewardForUncles)
} else if u.config.Network == "ethereum" || u.config.Network == "ropsten" || u.config.Network == "etica" { } else if u.config.Network == "ethereum" || u.config.Network == "ropsten" {
reward = getConstRewardEthereum(candidate.Height, u.config) reward = getConstRewardEthereum(candidate.Height, u.config)
// Add reward for including uncles // Add reward for including uncles
uncleReward := new(big.Int).Div(reward, big32) uncleReward := new(big.Int).Div(reward, big32)
@ -319,7 +317,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)) reward = getUncleRewardUbiq(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardUbiq(height))
} else if cfg.Network == "callisto" { } else if cfg.Network == "callisto" {
reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardcallisto(height)) reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardcallisto(height))
} else if cfg.Network == "ethereum" || cfg.Network == "ropsten" || cfg.Network == "etica" { } else if cfg.Network == "ethereum" || cfg.Network == "ropsten" {
reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardUbiq(height)) reward = getUncleRewardEthereum(new(big.Int).SetInt64(uncleHeight), new(big.Int).SetInt64(height), getConstRewardUbiq(height))
} }
candidate.Height = height candidate.Height = height
@ -396,7 +394,6 @@ func (u *BlockUnlocker) unlockPendingBlocks() {
log.Printf("Failed to calculate rewards for round %v: %v", block.RoundKey(), err) log.Printf("Failed to calculate rewards for round %v: %v", block.RoundKey(), err)
return return
} }
log.Printf("RoundRewards 2 %v", roundRewards)
err = u.backend.WriteImmatureBlock(block, roundRewards) err = u.backend.WriteImmatureBlock(block, roundRewards)
if err != nil { if err != nil {
u.halt = true u.halt = true
@ -494,7 +491,6 @@ func (u *BlockUnlocker) unlockAndCreditMiners() {
totalPoolProfit := new(big.Rat) totalPoolProfit := new(big.Rat)
for _, block := range result.maturedBlocks { for _, block := range result.maturedBlocks {
log.Printf("Blocks 2 %v", block)
revenue, minersProfit, poolProfit, roundRewards, percents, err := u.calculateRewards(block) revenue, minersProfit, poolProfit, roundRewards, percents, err := u.calculateRewards(block)
if err != nil { if err != nil {
u.halt = true u.halt = true
@ -728,9 +724,9 @@ func getConstRewardEthereum(height int64, cfg *UnlockerConfig) *big.Int {
// Select the correct block reward based on chain progression // Select the correct block reward based on chain progression
blockReward := frontierBlockReward blockReward := frontierBlockReward
headerNumber := big.NewInt(height) headerNumber := big.NewInt(height)
//if cfg.ByzantiumFBlock.Cmp(headerNumber) <= 0 { if cfg.ByzantiumFBlock.Cmp(headerNumber) <= 0 {
// blockReward = byzantiumBlockReward blockReward = byzantiumBlockReward
//} }
if cfg.ConstantinopleFBlock.Cmp(headerNumber) <= 0 { if cfg.ConstantinopleFBlock.Cmp(headerNumber) <= 0 {
blockReward = constantinopleBlockReward blockReward = constantinopleBlockReward
} }

2
proxy/miner.go

@ -23,8 +23,6 @@ func (s *ProxyServer) processShare(login, id, ip string, t *BlockTemplate, param
if hasher == nil { if hasher == nil {
if s.config.Network == "classic" { if s.config.Network == "classic" {
hasher = etchash.New(&ecip1099FBlockClassic, nil) hasher = etchash.New(&ecip1099FBlockClassic, nil)
} else if s.config.Network == "etica" {
hasher = etchash.New(nil, nil)
} else if s.config.Network == "mordor" { } else if s.config.Network == "mordor" {
hasher = etchash.New(&ecip1099FBlockMordor, nil) hasher = etchash.New(&ecip1099FBlockMordor, nil)
} else if s.config.Network == "callisto" { } 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) { func (r *RedisClient) writeShare(tx *redis.Multi, ms, ts int64, login, id string, diff int64, actualDiff int64, expire time.Duration) {
times := int(diff / 100000000) times := int(diff / 1000000000)
for i := 0; i < times; i++ { for i := 0; i < times; i++ {
tx.LPush(r.formatKey("lastshares"), login) tx.LPush(r.formatKey("lastshares"), login)
} }

Loading…
Cancel
Save