aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/syncer/consensus.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/syncer/consensus.go b/core/syncer/consensus.go
index f2f8f9e..8d89d07 100644
--- a/core/syncer/consensus.go
+++ b/core/syncer/consensus.go
@@ -263,11 +263,14 @@ func (con *Consensus) ForceSync(skip bool) {
con.setupConfigsUntilRound(block.Position.Round + core.ConfigRoundShift - 1)
con.syncedLastBlock = &block
con.stopBuffering()
- con.dummyCancel, con.dummyFinished = utils.LaunchDummyReceiver(
- context.Background(), con.network.ReceiveChan(),
- func(msg interface{}) {
- con.dummyMsgBuffer = append(con.dummyMsgBuffer, msg)
- })
+ // We might call stopBuffering without calling assureBuffering.
+ if con.dummyCancel == nil {
+ con.dummyCancel, con.dummyFinished = utils.LaunchDummyReceiver(
+ context.Background(), con.network.ReceiveChan(),
+ func(msg interface{}) {
+ con.dummyMsgBuffer = append(con.dummyMsgBuffer, msg)
+ })
+ }
con.syncedSkipNext = skip
}