Skip to content

Commit

Permalink
Body downloader: fix empty withdrawals in empty bodies (erigontech#6893)
Browse files Browse the repository at this point in the history
Potentially fixes Issue erigontech#6817.
  • Loading branch information
yperbasis authored and finiteops committed Apr 10, 2023
1 parent 703c0ca commit 0c16f4e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions turbo/stages/bodydownload/body_algos.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,23 @@ func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullB
}
}
if request {
if header.UncleHash != types.EmptyUncleHash || header.TxHash != types.EmptyRootHash ||
(header.WithdrawalsHash != nil && *header.WithdrawalsHash != types.EmptyRootHash) {
if header.UncleHash == types.EmptyUncleHash && header.TxHash == types.EmptyRootHash &&
(header.WithdrawalsHash == nil || *header.WithdrawalsHash == types.EmptyRootHash) {
// Empty block body
body := &types.RawBody{}
if header.WithdrawalsHash != nil {
// implies *header.WithdrawalsHash == types.EmptyRootHash
body.Withdrawals = make([]*types.Withdrawal, 0)
}
bd.addBodyToCache(blockNum, body)
request = false
} else {
// Perhaps we already have this block
block := rawdb.ReadBlock(tx, hash, blockNum)
if block != nil {
bd.addBodyToCache(blockNum, block.RawBody())
request = false
}
} else {
bd.addBodyToCache(blockNum, &types.RawBody{})
request = false
}
}
if request {
Expand Down

0 comments on commit 0c16f4e

Please sign in to comment.