Skip to content

Commit

Permalink
Fixed data race. (#4686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozen committed Jul 19, 2024
1 parent 8306c60 commit a65cf71
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/blockchain_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ func (bc *BlockChainImpl) ValidateNewBlock(block *types.Block, beaconChain Block
if block.NumberU64() <= bc.CurrentBlock().NumberU64() {
return errors.Errorf("block with the same block number is already committed: %d", block.NumberU64())
}

bc.chainmu.Lock()
defer bc.chainmu.Unlock()
if err := bc.validator.ValidateHeader(block, true); err != nil {
utils.Logger().Error().
Str("blockHash", block.Hash().Hex()).
Expand Down

0 comments on commit a65cf71

Please sign in to comment.