aboutsummaryrefslogtreecommitdiffstats
path: root/core/agreement-state.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-11-09 12:23:58 +0800
committerGitHub <noreply@github.com>2018-11-09 12:23:58 +0800
commita7e3c046693d9df860422e71a14c8659b36afe6a (patch)
tree3c4148b202a3d2acb3e326198c10c1b4b35738f6 /core/agreement-state.go
parent71a1dd9c072fb64da026ebe56acd2d187ec272c8 (diff)
downloaddexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar.gz
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar.bz2
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar.lz
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar.xz
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.tar.zst
dexon-consensus-a7e3c046693d9df860422e71a14c8659b36afe6a.zip
core: Extract VoteHeader (#313)
Diffstat (limited to 'core/agreement-state.go')
-rw-r--r--core/agreement-state.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/core/agreement-state.go b/core/agreement-state.go
index fe329f8..9023799 100644
--- a/core/agreement-state.go
+++ b/core/agreement-state.go
@@ -72,11 +72,7 @@ func (s *initialState) nextState() (agreementState, error) {
hash := s.a.recv.ProposeBlock()
s.a.lock.Lock()
defer s.a.lock.Unlock()
- s.a.recv.ProposeVote(&types.Vote{
- Type: types.VoteInit,
- BlockHash: hash,
- Period: s.a.period,
- })
+ s.a.recv.ProposeVote(types.NewVote(types.VoteInit, hash, s.a.period))
return newPreCommitState(s.a), nil
}
@@ -98,11 +94,7 @@ func (s *preCommitState) nextState() (agreementState, error) {
if hash == nullBlockHash {
hash = s.a.leader.leaderBlockHash()
}
- s.a.recv.ProposeVote(&types.Vote{
- Type: types.VotePreCom,
- BlockHash: hash,
- Period: s.a.period,
- })
+ s.a.recv.ProposeVote(types.NewVote(types.VotePreCom, hash, s.a.period))
return newCommitState(s.a), nil
}
@@ -127,11 +119,7 @@ func (s *commitState) nextState() (agreementState, error) {
} else {
hash = skipBlockHash
}
- s.a.recv.ProposeVote(&types.Vote{
- Type: types.VoteCom,
- BlockHash: hash,
- Period: s.a.period,
- })
+ s.a.recv.ProposeVote(types.NewVote(types.VoteCom, hash, s.a.period))
return newForwardState(s.a), nil
}