aboutsummaryrefslogtreecommitdiffstats
path: root/core/agreement.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-02-13 10:32:53 +0800
committerGitHub <noreply@github.com>2019-02-13 10:32:53 +0800
commit7f57f843e14dc1c75c8747bd0e65ee3ee6de6d72 (patch)
tree3d156111ac48bc2e2aaa6177e0d7311ce2257184 /core/agreement.go
parent8ba8902ca54f2c29fb20231821b71b720f467985 (diff)
downloaddexon-consensus-7f57f843e14dc1c75c8747bd0e65ee3ee6de6d72.tar.gz
dexon-consensus-7f57f843e14dc1c75c8747bd0e65ee3ee6de6d72.tar.zst
dexon-consensus-7f57f843e14dc1c75c8747bd0e65ee3ee6de6d72.zip
core: fast forward should close previous done() channel (#444)
* core: fast forward faster * core: modify unit test
Diffstat (limited to 'core/agreement.go')
-rw-r--r--core/agreement.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/agreement.go b/core/agreement.go
index 1870a50..10ba354 100644
--- a/core/agreement.go
+++ b/core/agreement.go
@@ -468,6 +468,7 @@ func (a *agreement) processVote(vote *types.Vote) error {
a.data.lockIter = vote.Period
}
a.fastForward <- vote.Period
+ close(a.doneChan)
return nil
}
}
@@ -493,6 +494,7 @@ func (a *agreement) processVote(vote *types.Vote) error {
a.data.recv.PullBlocks(hashes)
}
a.fastForward <- vote.Period + 1
+ close(a.doneChan)
return nil
}
return nil
@@ -513,7 +515,6 @@ func (a *agreement) done() <-chan struct{} {
}
a.data.setPeriod(period)
a.state = newPreCommitState(a.data)
- close(a.doneChan)
a.doneChan = make(chan struct{})
return closedchan
default: