fix: set withdrawals properly when fetching empty block (#2386)
This commit is contained in:
parent
f4bad20447
commit
d7836bfe98
@ -639,6 +639,9 @@ func (f *BlockFetcher) loop() {
|
||||
log.Trace("Block empty, skipping body retrieval", "peer", announce.origin, "number", header.Number, "hash", header.Hash())
|
||||
|
||||
block := types.NewBlockWithHeader(header)
|
||||
if block.Header().EmptyWithdrawalsHash() {
|
||||
block = block.WithWithdrawals(make([]*types.Withdrawal, 0))
|
||||
}
|
||||
block.ReceivedAt = task.time
|
||||
|
||||
complete = append(complete, block)
|
||||
|
@ -366,7 +366,6 @@ func handleBlockBodies(backend Backend, msg Decoder, peer *Peer) error {
|
||||
for i, body := range res.BlockBodiesResponse {
|
||||
txsHashes[i] = types.DeriveSha(types.Transactions(body.Transactions), hasher)
|
||||
uncleHashes[i] = types.CalcUncleHash(body.Uncles)
|
||||
// Withdrawals may be not nil, but a empty value when Sidecars not empty
|
||||
if body.Withdrawals != nil {
|
||||
withdrawalHashes[i] = types.DeriveSha(types.Withdrawals(body.Withdrawals), hasher)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user