• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision7f73f925078115b7135bad14aaf03bf4260bbdfd (tree)
Zeit2021-03-15 11:42:14
Autorpaladz <colt@Colt...>
Commiterpaladz

Log Message

update reward distribuction tool

Ändern Zusammenfassung

Diff

--- a/toolbar/vote_reward/settlementvotereward/settlementreward.go
+++ b/toolbar/vote_reward/settlementvotereward/settlementreward.go
@@ -21,7 +21,10 @@ var (
2121 errNotRewardTx = errors.New("No reward transaction")
2222 )
2323
24-const standbyNodesRewardForConsensusCycle = 7610350076 // 400000000000000 / (365 * 24 * 60 / (500 * 1200 / 1000 / 60))
24+const (
25+ standbyNodesRewardForConsensusCycle = 7610350076 // 400000000000000 / (365 * 24 * 60 / (500 * 1200 / 1000 / 60))
26+ standbyNodeNum = 32
27+)
2528
2629 type voteResult struct {
2730 VoteAddress string
@@ -115,10 +118,8 @@ func (s *SettlementReward) getStandbyNodeReward(height uint64) (uint64, error) {
115118 }
116119
117120 voteInfos = common.CalcStandByNodes(voteInfos)
118-
119- totalVoteNum, xpubVoteNum := uint64(0), uint64(0)
121+ xpubVoteNum := uint64(0)
120122 for _, voteInfo := range voteInfos {
121- totalVoteNum += voteInfo.VoteNum
122123 if s.rewardCfg.XPub == voteInfo.Vote {
123124 xpubVoteNum = voteInfo.VoteNum
124125 }
@@ -128,12 +129,10 @@ func (s *SettlementReward) getStandbyNodeReward(height uint64) (uint64, error) {
128129 return 0, errNotStandbyNode
129130 }
130131
131- amount := big.NewInt(0).SetUint64(standbyNodesRewardForConsensusCycle)
132+ amount := big.NewInt(0).SetUint64(standbyNodesRewardForConsensusCycle / standbyNodeNum)
132133 rewardRatio := big.NewInt(0).SetUint64(s.rewardCfg.RewardRatio)
133134 amount.Mul(amount, rewardRatio).Div(amount, big.NewInt(100))
134- total := big.NewInt(0).SetUint64(totalVoteNum)
135- voteNum := big.NewInt(0).SetUint64(xpubVoteNum)
136- return amount.Mul(amount, voteNum).Div(amount, total).Uint64(), nil
135+ return amount.Uint64(), nil
137136 }
138137
139138 func (s *SettlementReward) getCoinbaseReward(height uint64) (uint64, error) {
Show on old repository browser