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@byzantine-lab.io>2019-06-12 17:27:21 +0800
commit36e65e7017fc87c44b52b736e09585fc2bfc1e3b (patch)
tree01c0bd136d560f8657b16aa2a4bc9270205306e7 /vendor/github.com/dexon-foundation/dexon-consensus/core/utils.go
parentd1d2cc0736440d7d6154df11f8cb9281c3e3f7f7 (diff)
downloadgo-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar.gz
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar.bz2
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar.lz
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar.xz
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.tar.zst
go-tangerine-36e65e7017fc87c44b52b736e09585fc2bfc1e3b.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