core/types: add empty withdrawls to body if len == 0

This commit is contained in:
lightclient 2024-04-22 14:39:23 -06:00
parent 5d8522118e
commit bcea950238
No known key found for this signature in database
GPG key ID: 75C916AFEE20183E

View file

@ -260,6 +260,7 @@ func NewBlock(header *Header, body *Body, receipts []*Receipt, hasher TrieHasher
b.header.WithdrawalsHash = nil
} else if len(withdrawals) == 0 {
b.header.WithdrawalsHash = &EmptyWithdrawalsHash
b.withdrawals = Withdrawals{}
} else {
hash := DeriveSha(Withdrawals(withdrawals), hasher)
b.header.WithdrawalsHash = &hash