mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-22 15:59:26 +00:00
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.
This commit is contained in:
parent
a46bd22ba9
commit
e1521be67a
1 changed files with 4 additions and 0 deletions
|
|
@ -333,6 +333,10 @@ func CopyHeader(h *Header) *Header {
|
||||||
cpy.RequestsHash = new(common.Hash)
|
cpy.RequestsHash = new(common.Hash)
|
||||||
*cpy.RequestsHash = *h.RequestsHash
|
*cpy.RequestsHash = *h.RequestsHash
|
||||||
}
|
}
|
||||||
|
if h.BlockAccessListHash != nil {
|
||||||
|
cpy.BlockAccessListHash = new(common.Hash)
|
||||||
|
*cpy.BlockAccessListHash = *h.BlockAccessListHash
|
||||||
|
}
|
||||||
if h.SlotNumber != nil {
|
if h.SlotNumber != nil {
|
||||||
cpy.SlotNumber = new(uint64)
|
cpy.SlotNumber = new(uint64)
|
||||||
*cpy.SlotNumber = *h.SlotNumber
|
*cpy.SlotNumber = *h.SlotNumber
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue