• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision6bdec32153bf34bf6dfd85852513ae6b1b5b6aa3 (tree)
Time2019-07-25 18:20:41
Authormars <mars@byto...>
Commitermars

Log Message

fix review

Change Summary

Incremental Difference

--- a/toolbar/vote_reward/settlementvotereward/settlementreward.go
+++ b/toolbar/vote_reward/settlementvotereward/settlementreward.go
@@ -15,9 +15,9 @@ import (
1515 )
1616
1717 var (
18- errFoundReward = errors.New("No reward found")
19- errNoStandbyNode = errors.New("No Standby Node")
20- errNoRewardTx = errors.New("No reward transaction")
18+ errNotFoundReward = errors.New("No reward found")
19+ errNotStandbyNode = errors.New("No Standby Node")
20+ errNotRewardTx = errors.New("No reward transaction")
2121 )
2222
2323 const standbyNodesRewardForConsensusCycle = 7610350076 // 400000000000000 / (365 * 24 * 60 / (500 * 1200 / 1000 / 60))
@@ -61,11 +61,11 @@ func (s *SettlementReward) getVoteResultFromDB(height uint64) (voteResults []*vo
6161 func (s *SettlementReward) Settlement() error {
6262 for height := s.startHeight + consensus.ActiveNetParams.RoundVoteBlockNums; height <= s.endHeight; height += consensus.ActiveNetParams.RoundVoteBlockNums {
6363 totalReward, err := s.getCoinbaseReward(height + 1)
64- if err == errFoundReward {
64+ if err == errNotFoundReward {
6565 totalReward, err = s.getStandbyNodeReward(height - consensus.ActiveNetParams.RoundVoteBlockNums)
6666 }
6767
68- if err == errNoStandbyNode {
68+ if err == errNotStandbyNode {
6969 continue
7070 }
7171
@@ -82,7 +82,7 @@ func (s *SettlementReward) Settlement() error {
8282 }
8383
8484 if len(s.rewards) == 0 {
85- return errNoRewardTx
85+ return errNotRewardTx
8686 }
8787
8888 // send transactions
@@ -106,7 +106,7 @@ func (s *SettlementReward) getStandbyNodeReward(height uint64) (uint64, error) {
106106 }
107107
108108 if xpubVoteNum == 0 {
109- return 0, errNoStandbyNode
109+ return 0, errNotStandbyNode
110110 }
111111
112112 amount := big.NewInt(0).SetUint64(standbyNodesRewardForConsensusCycle)
@@ -146,7 +146,7 @@ func (s *SettlementReward) getCoinbaseReward(height uint64) (uint64, error) {
146146 return amount.Uint64(), nil
147147 }
148148 }
149- return 0, errFoundReward
149+ return 0, errNotFoundReward
150150 }
151151
152152 func (s *SettlementReward) calcVoterRewards(voteResults []*voteResult, totalReward uint64) {
Show on old repository browser