aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-23 13:04:02 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:56 +0800
commit194210ddd461efb9c38ae93881e1f90a283b34d3 (patch)
tree12b999be4629977316e38d79b23cc11c1a9e95ce /vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
parentb625c03153b961a05f5610bcb6089034d66b5b0c (diff)
downloaddexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar.gz
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar.bz2
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar.lz
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar.xz
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.tar.zst
dexon-194210ddd461efb9c38ae93881e1f90a283b34d3.zip
params: Update testnet config (#167)
* vendor: sync to latest core * param: update testnet config * params: update dmoment
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go')
-rw-r--r--vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
index 3b1069eb8..14780e73b 100644
--- a/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
+++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
@@ -32,6 +32,20 @@ import (
"github.com/dexon-foundation/dexon-consensus/core/utils"
)
+// Errors for utils.
+var (
+ ErrIncorrectVoteBlockHash = fmt.Errorf(
+ "incorrect vote block hash")
+ ErrIncorrectVoteType = fmt.Errorf(
+ "incorrect vote type")
+ ErrIncorrectVotePosition = fmt.Errorf(
+ "incorrect vote position")
+ ErrIncorrectVoteProposer = fmt.Errorf(
+ "incorrect vote proposer")
+ ErrIncorrectVotePeriod = fmt.Errorf(
+ "incorrect vote period")
+)
+
// NodeSetCache is type alias to avoid fullnode compile error when moving
// it to core/utils package.
type NodeSetCache = utils.NodeSetCache
@@ -161,10 +175,14 @@ func VerifyAgreementResult(
}
voted := make(map[types.NodeID]struct{}, len(notarySet))
voteType := res.Votes[0].Type
- if voteType != types.VoteFast && voteType != types.VoteCom {
+ votePeriod := res.Votes[0].Period
+ if voteType != types.VoteFastCom && voteType != types.VoteCom {
return ErrIncorrectVoteType
}
for _, vote := range res.Votes {
+ if vote.Period != votePeriod {
+ return ErrIncorrectVotePeriod
+ }
if res.IsEmptyBlock {
if (vote.BlockHash != common.Hash{}) {
return ErrIncorrectVoteBlockHash