OSDN Git Service

Merge pull request #1751 from Bytom/blockfetcher
[bytom/bytom.git] / netsync / block_fetcher.go
index 8baa33a..777d1d5 100644 (file)
@@ -39,10 +39,9 @@ func newBlockFetcher(chain Chain, 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
                        }