diff --git a/node/node.go b/node/node.go index dbc9639eb..573786c00 100644 --- a/node/node.go +++ b/node/node.go @@ -499,10 +499,6 @@ func (node *Node) validateNodeMessage(ctx context.Context, payload []byte) ( utils.Logger().Debug().Uint64("receivedNum", block.NumberU64()). Uint64("currentNum", curBeaconHeight).Msg("beacon block sync message rejected") return nil, 0, errors.New("beacon block height smaller than current height beyond tolerance") - } else if block.NumberU64()-beaconBlockHeightTolerance > curBeaconHeight { - utils.Logger().Debug().Uint64("receivedNum", block.NumberU64()). - Uint64("currentNum", curBeaconHeight).Msg("beacon block sync message rejected") - return nil, 0, errors.Errorf("beacon block height too much higher than current height beyond tolerance, block %d, current %d, epoch %d , current %d", block.NumberU64(), curBeaconHeight, block.Epoch().Uint64(), curBeaconBlock.Epoch().Uint64()) } else if block.NumberU64() <= curBeaconHeight { utils.Logger().Debug().Uint64("receivedNum", block.NumberU64()). Uint64("currentNum", curBeaconHeight).Msg("beacon block sync message ignored") diff --git a/node/node_handler.go b/node/node_handler.go index eeaf90f2d..c5feeed07 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -76,8 +76,6 @@ func (node *Node) HandleNodeMessage( if node.Blockchain().ShardID() != shard.BeaconChainShardID { for _, block := range blocks { if block.ShardID() == 0 { - utils.Logger().Info(). - Msgf("Beacon block being handled by block channel: %d", block.NumberU64()) if block.IsLastBlockInEpoch() { go func(blk *types.Block) { node.BeaconBlockChannel <- blk diff --git a/node/node_syncing.go b/node/node_syncing.go index 830df25c0..5319827ff 100644 --- a/node/node_syncing.go +++ b/node/node_syncing.go @@ -231,7 +231,16 @@ func (node *Node) doBeaconSyncing() { // If Downloader is not working, we need also deal with blocks from beaconBlockChannel go func(node *Node) { // TODO ek – infinite loop; add shutdown/cleanup logic - for _ = range node.BeaconBlockChannel { + for b := range node.BeaconBlockChannel { + if b != nil && b.IsLastBlockInEpoch() { + _, err := node.EpochChain().InsertChain(types.Blocks{b}, true) + if err != nil { + utils.Logger().Error().Err(err).Msgf("[SYNC] InsertChain failed shard: %d epoch:%d number:%d", b.Header().ShardID(), b.Epoch().Uint64(), b.NumberU64()) + } else { + utils.Logger().Info(). + Msgf("Beacon block being handled by block channel: epoch: %d, number: %d", b.Epoch().Uint64(), b.NumberU64()) + } + } } }(node) }