diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-11-02 16:05:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-02 16:05:25 +0800 |
commit | 513bfa84c18c53d1d9d7a02b68945a758d825362 (patch) | |
tree | c616b379a975724ffdab6984c0a13cb4d173abf7 /core/agreement.go | |
parent | 5170bff5f5332fd7782f300cb4a1d63f3cd3664c (diff) | |
download | dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar.gz dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar.bz2 dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar.lz dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar.xz dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.tar.zst dexon-consensus-513bfa84c18c53d1d9d7a02b68945a758d825362.zip |
core: reset CRS in leader selector by round (#286)
Diffstat (limited to 'core/agreement.go')
-rw-r--r-- | core/agreement.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/core/agreement.go b/core/agreement.go index 8741baf..d6875bc 100644 --- a/core/agreement.go +++ b/core/agreement.go @@ -118,7 +118,6 @@ type agreement struct { func newAgreement( ID types.NodeID, recv agreementReceiver, - notarySet map[types.NodeID]struct{}, leader *leaderSelector, authModule *Authenticator) *agreement { agreement := &agreement{ @@ -137,7 +136,7 @@ func newAgreement( // restart the agreement func (a *agreement) restart( - notarySet map[types.NodeID]struct{}, aID types.Position) { + notarySet map[types.NodeID]struct{}, aID types.Position, crs common.Hash) { func() { a.lock.Lock() @@ -151,7 +150,7 @@ func (a *agreement) restart( a.data.period = 1 a.data.blocks = make(map[types.NodeID]*types.Block) a.data.requiredVote = len(notarySet)/3*2 + 1 - a.data.leader.restart() + a.data.leader.restart(crs) a.data.lockValue = nullBlockHash a.data.lockRound = 1 a.fastForward = make(chan uint64, 1) @@ -213,7 +212,7 @@ func (a *agreement) restart( func (a *agreement) stop() { a.restart(make(map[types.NodeID]struct{}), types.Position{ ChainID: math.MaxUint32, - }) + }, common.Hash{}) } func isStop(aID types.Position) bool { |