eth/protocols: add Withdrawals check before broadcastBlock
This commit is contained in:
parent
d141ff06c3
commit
5289ecdfe2
@ -320,23 +320,12 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
||||
}
|
||||
|
||||
broadcastBlockWithCheck := func(block *types.Block, propagate bool) {
|
||||
// All the block fetcher activities should be disabled
|
||||
// after the transition. Print the warning log.
|
||||
if h.merger.PoSFinalized() {
|
||||
log.Warn("Unexpected validation activity", "hash", block.Hash(), "number", block.Number())
|
||||
return
|
||||
}
|
||||
// Reject all the PoS style headers in the first place. No matter
|
||||
// the chain has finished the transition or not, the PoS headers
|
||||
// should only come from the trusted consensus layer instead of
|
||||
// p2p network.
|
||||
if beacon, ok := h.chain.Engine().(*beacon.Beacon); ok {
|
||||
if beacon.IsPoSHeader(block.Header()) {
|
||||
log.Warn("unexpected post-merge header")
|
||||
return
|
||||
}
|
||||
}
|
||||
if propagate {
|
||||
if !(block.Header().WithdrawalsHash == nil && block.Withdrawals() == nil) &&
|
||||
!(block.Header().EmptyWithdrawalsHash() && block.Withdrawals() != nil && len(block.Withdrawals()) == 0) {
|
||||
log.Error("Propagated block has invalid withdrawals")
|
||||
return
|
||||
}
|
||||
if err := core.IsDataAvailable(h.chain, block); err != nil {
|
||||
log.Error("Propagating block with invalid sidecars", "number", block.Number(), "hash", block.Hash(), "err", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user