Golang implemented sidechain for Bytom
Revision | 6bdec32153bf34bf6dfd85852513ae6b1b5b6aa3 (tree) |
---|---|
Zeit | 2019-07-25 18:20:41 |
Autor | mars <mars@byto...> |
Commiter | mars |
fix review
@@ -15,9 +15,9 @@ import ( | ||
15 | 15 | ) |
16 | 16 | |
17 | 17 | 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") | |
21 | 21 | ) |
22 | 22 | |
23 | 23 | const standbyNodesRewardForConsensusCycle = 7610350076 // 400000000000000 / (365 * 24 * 60 / (500 * 1200 / 1000 / 60)) |
@@ -61,11 +61,11 @@ func (s *SettlementReward) getVoteResultFromDB(height uint64) (voteResults []*vo | ||
61 | 61 | func (s *SettlementReward) Settlement() error { |
62 | 62 | for height := s.startHeight + consensus.ActiveNetParams.RoundVoteBlockNums; height <= s.endHeight; height += consensus.ActiveNetParams.RoundVoteBlockNums { |
63 | 63 | totalReward, err := s.getCoinbaseReward(height + 1) |
64 | - if err == errFoundReward { | |
64 | + if err == errNotFoundReward { | |
65 | 65 | totalReward, err = s.getStandbyNodeReward(height - consensus.ActiveNetParams.RoundVoteBlockNums) |
66 | 66 | } |
67 | 67 | |
68 | - if err == errNoStandbyNode { | |
68 | + if err == errNotStandbyNode { | |
69 | 69 | continue |
70 | 70 | } |
71 | 71 |
@@ -82,7 +82,7 @@ func (s *SettlementReward) Settlement() error { | ||
82 | 82 | } |
83 | 83 | |
84 | 84 | if len(s.rewards) == 0 { |
85 | - return errNoRewardTx | |
85 | + return errNotRewardTx | |
86 | 86 | } |
87 | 87 | |
88 | 88 | // send transactions |
@@ -106,7 +106,7 @@ func (s *SettlementReward) getStandbyNodeReward(height uint64) (uint64, error) { | ||
106 | 106 | } |
107 | 107 | |
108 | 108 | if xpubVoteNum == 0 { |
109 | - return 0, errNoStandbyNode | |
109 | + return 0, errNotStandbyNode | |
110 | 110 | } |
111 | 111 | |
112 | 112 | amount := big.NewInt(0).SetUint64(standbyNodesRewardForConsensusCycle) |
@@ -146,7 +146,7 @@ func (s *SettlementReward) getCoinbaseReward(height uint64) (uint64, error) { | ||
146 | 146 | return amount.Uint64(), nil |
147 | 147 | } |
148 | 148 | } |
149 | - return 0, errFoundReward | |
149 | + return 0, errNotFoundReward | |
150 | 150 | } |
151 | 151 | |
152 | 152 | func (s *SettlementReward) calcVoterRewards(voteResults []*voteResult, totalReward uint64) { |