OSDN Git Service

Fix block fetcher block insert bug (#95)
[bytom/vapor.git] / netsync / consensusmgr / block_fetcher.go
index 6278c61..3b6c746 100644 (file)
@@ -40,10 +40,9 @@ func newBlockFetcher(chain Chain, peers *peers.PeerSet) *blockFetcher {
 
 func (f *blockFetcher) blockProcessor() {
        for {
-               height := f.chain.BestBlockHeight()
                for !f.queue.Empty() {
                        msg := f.queue.PopItem().(*blockMsg)
-                       if msg.block.Height > height+1 {
+                       if msg.block.Height > f.chain.BestBlockHeight()+1 {
                                f.queue.Push(msg, -float32(msg.block.Height))
                                break
                        }