From 738134a7da2f7561da17f589fafd74fc3fc2e6e6 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Sat, 30 Nov 2019 00:11:35 -0800 Subject: [PATCH] Fix sync bug --- api/service/syncing/syncing.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/service/syncing/syncing.go b/api/service/syncing/syncing.go index ea8072bee..88dc46fa4 100644 --- a/api/service/syncing/syncing.go +++ b/api/service/syncing/syncing.go @@ -536,9 +536,10 @@ func (ss *StateSync) getBlockFromLastMileBlocksByParentHash(parentHash common.Ha // UpdateBlockAndStatus ... func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc *core.BlockChain, worker *worker.Worker, verifyAllSig bool) error { - utils.Logger().Info().Str("blockHex", bc.CurrentBlock().Hash().Hex()).Msg("[SYNC] UpdateBlockAndStatus: Current Block") + utils.Logger().Info().Str("blockHex", bc.CurrentBlock().Hash().Hex()).Uint64("blockNum", block.NumberU64()).Msg("[SYNC] UpdateBlockAndStatus: Current Block") - if block.NumberU64() >= bc.CurrentHeader().Number().Uint64() { + if block.NumberU64() != bc.CurrentHeader().Number().Uint64()+1 { + utils.Logger().Info().Uint64("curBlockNum", bc.CurrentHeader().Number().Uint64()).Uint64("receivedBlockNum", block.NumberU64()).Msg("[SYNC] Inappropriate block number, ignore!") return nil }