Skip to content

Commit b9e5186

Browse files
committed
Export copyHeader as CopyEthHeader
1 parent 0508241 commit b9e5186

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/types/block.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ func NewBlockWithWithdrawals(header *Header, txs []*Transaction, uncles []*Heade
277277
return b.WithWithdrawals(withdrawals)
278278
}
279279

280-
func copyHeader(h *Header) *Header {
280+
// CopyEthHeader creates a deep copy of an Ethereum block header.
281+
// Use [CopyHeader] instead if your header has any registered extra.
282+
func CopyEthHeader(h *Header) *Header {
281283
cpy := *h
282284
if cpy.Difficulty = new(big.Int); h.Difficulty != nil {
283285
cpy.Difficulty.Set(h.Difficulty)

core/types/block.libevm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (*NOOPHeaderHooks) DecodeRLP(h *Header, s *rlp.Stream) error {
111111
}
112112

113113
func (n *NOOPHeaderHooks) Copy(h *Header) *Header {
114-
return copyHeader(h)
114+
return CopyEthHeader(h)
115115
}
116116

117117
// CopyHeader creates a deep copy of a block header.

0 commit comments

Comments
 (0)