Do not rollback current block on failed block sync (#3101)

pull/3102/head
Rongjian Lan 4 years ago committed by GitHub
parent 44185906a8
commit 00fa7f4f4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      api/service/syncing/syncing.go
  2. 1
      node/node_handler.go

@ -597,7 +597,7 @@ func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc *core.BlockChai
utils.Logger().Error().Err(err).Msgf("[SYNC] UpdateBlockAndStatus: failed verifying signatures for new block %d", block.NumberU64())
if !verifyAllSig {
utils.Logger().Debug().Interface("block", bc.CurrentBlock()).Msg("[SYNC] UpdateBlockAndStatus: Rolling back last 99 blocks!")
utils.Logger().Info().Interface("block", bc.CurrentBlock()).Msg("[SYNC] UpdateBlockAndStatus: Rolling back last 99 blocks!")
for i := uint64(0); i < verifyHeaderBatchSize-1; i++ {
bc.Rollback([]common.Hash{bc.CurrentBlock().Hash()})
}
@ -615,11 +615,6 @@ func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc *core.BlockChai
block.NumberU64(),
block.ShardID(),
)
utils.Logger().Debug().
Interface("block", bc.CurrentBlock()).
Msg("[SYNC] UpdateBlockAndStatus: Rolling back current block!")
bc.Rollback([]common.Hash{bc.CurrentBlock().Hash()})
return err
}
utils.Logger().Info().

@ -126,7 +126,6 @@ func (node *Node) HandleMessage(content []byte, sender libp2p_peer.ID) {
for _, block := range blocks {
if block.ShardID() == 0 {
utils.Logger().Info().
Uint64("block", blocks[0].NumberU64()).
Msgf("Beacon block being handled by block channel: %d", block.NumberU64())
go func(blk *types.Block) {
node.BeaconBlockChannel <- blk

Loading…
Cancel
Save