Skip to content

Commit a247ae0

Browse files
CPerezzjwasinger
authored andcommitted
core/types: fix CopyHeader missing BlockAccessListHash deep copy
CopyHeader copies all pointer-typed header fields (WithdrawalsHash, RequestsHash, SlotNumber, etc.) but was missing the deep copy for BlockAccessListHash added by EIP-7928. This caused the BAL hash to be silently shared between the original and the copy, leading to potential data races and incorrect nil-checks on copied headers.
1 parent e2ce38e commit a247ae0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/types/block.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ func CopyHeader(h *Header) *Header {
333333
cpy.RequestsHash = new(common.Hash)
334334
*cpy.RequestsHash = *h.RequestsHash
335335
}
336+
if h.BlockAccessListHash != nil {
337+
cpy.BlockAccessListHash = new(common.Hash)
338+
*cpy.BlockAccessListHash = *h.BlockAccessListHash
339+
}
336340
if h.SlotNumber != nil {
337341
cpy.SlotNumber = new(uint64)
338342
*cpy.SlotNumber = *h.SlotNumber

0 commit comments

Comments
 (0)