Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed outdated check. #4574

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 0 additions & 2 deletions node/node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion node/node_syncing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down