aboutsummaryrefslogtreecommitdiffstats
path: root/core/types/vote.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-09-03 10:01:40 +0800
committerGitHub <noreply@github.com>2018-09-03 10:01:40 +0800
commitc8d3092208f73ee991a123052a71b7dbf7fffc27 (patch)
treefdcb3b90b859531e042dbbdd6bcd7b0cca40e86a /core/types/vote.go
parent9491ddae81640e04f8aed38e2cddeb64cc62d55b (diff)
downloadtangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.gz
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.bz2
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.lz
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.xz
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.tar.zst
tangerine-consensus-c8d3092208f73ee991a123052a71b7dbf7fffc27.zip
core: Add a new structure `Position` and move `ShardID`, `ChainID` and `Height` from `Block` (#89)
Diffstat (limited to 'core/types/vote.go')
-rw-r--r--core/types/vote.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/core/types/vote.go b/core/types/vote.go
index 1247f84..158c209 100644
--- a/core/types/vote.go
+++ b/core/types/vote.go
@@ -38,11 +38,12 @@ const (
// Vote is the vote structure defined in Crypto Shuffle Algorithm.
type Vote struct {
- ProposerID ValidatorID
- Type VoteType
- BlockHash common.Hash
- Period uint64
- Signature crypto.Signature
+ ProposerID ValidatorID `json:"proposer_id"`
+ Type VoteType `json:"type"`
+ BlockHash common.Hash `json:"block_hash"`
+ Period uint64 `json:"period"`
+ Position Position `json:"position"`
+ Signature crypto.Signature `json:"signature"`
}
func (v *Vote) String() string {
@@ -57,6 +58,11 @@ func (v *Vote) Clone() *Vote {
Type: v.Type,
BlockHash: v.BlockHash,
Period: v.Period,
- Signature: v.Signature.Clone(),
+ Position: Position{
+ ShardID: v.Position.ShardID,
+ ChainID: v.Position.ChainID,
+ Height: v.Position.Height,
+ },
+ Signature: v.Signature.Clone(),
}
}