diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-01-10 18:01:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 18:01:10 +0800 |
commit | fa25817354d5b7d40f5911004232392acfe7fe53 (patch) | |
tree | 6e9c68971d4e5fecbd126568ebdb7f1026935d93 /core/agreement.go | |
parent | 995e571375298923bf07d205237a664b03de3b57 (diff) | |
download | dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar.gz dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar.bz2 dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar.lz dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar.xz dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.tar.zst dexon-consensus-fa25817354d5b7d40f5911004232392acfe7fe53.zip |
core: fix issues in consensus core (#415)
Diffstat (limited to 'core/agreement.go')
-rw-r--r-- | core/agreement.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/core/agreement.go b/core/agreement.go index 11ed89a..f9cf546 100644 --- a/core/agreement.go +++ b/core/agreement.go @@ -281,16 +281,12 @@ func (a *agreement) leader() types.NodeID { // nextState is called at the specific clock time. func (a *agreement) nextState() (err error) { - if func() bool { - a.lock.RLock() - defer a.lock.RUnlock() - return a.hasOutput - }() { + a.lock.Lock() + defer a.lock.Unlock() + if a.hasOutput { a.state = newSleepState(a.data) return } - a.lock.Lock() - defer a.lock.Unlock() a.state, err = a.state.nextState() return } |