diff --git a/blockchain/pool.go b/blockchain/pool.go index 993ce73ef61..8f4f522eac0 100644 --- a/blockchain/pool.go +++ b/blockchain/pool.go @@ -66,6 +66,7 @@ type BlockPool struct { mtx sync.Mutex // block requests requesters map[int64]*bpRequester + initHeight int64 height int64 // the lowest key in requesters. // peers peers map[p2p.ID]*bpPeer @@ -83,6 +84,7 @@ func NewBlockPool(start int64, requestsCh chan<- BlockRequest, errorsCh chan<- p peers: make(map[p2p.ID]*bpPeer), requesters: make(map[int64]*bpRequester), + initHeight: start, height: start, numPending: 0, diff --git a/blockchain/reactor.go b/blockchain/reactor.go index 714c3322358..3abb747945d 100644 --- a/blockchain/reactor.go +++ b/blockchain/reactor.go @@ -286,7 +286,7 @@ FOR_LOOP: // numPending=0 total=0 outbound=1 inbound=0 height=6601 blocksSynced=0 poolHeight=6601 poolstarttime=2019-02-22T09:02:07.881888662Z poolMaxPeerHeight=6437 poolHeight=6601 // we need make sure blockstore has a block because when switch to consensus, it will verify the commit between block and state // refer to `cs.blockStore.LoadSeenCommit(state.LastBlockHeight)` - if bcR.pool.IsCaughtUp() && (height == 1 || blocksSynced > 0) { + if bcR.pool.IsCaughtUp() && (height == bcR.pool.initHeight || blocksSynced > 0) { bcR.Logger.Info("Time to switch to consensus reactor!", "height", height) bcR.pool.Stop()