core/types: remove ils from block

This commit is contained in:
Marius van der Wijden 2024-03-19 01:49:15 +01:00
parent 422b30727d
commit e9aaf928d4

View file

@ -93,9 +93,6 @@ type Header struct {
// ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers. // ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.
ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"`
// InclusionListSummaryRoot was added by EIP-7547 and is ignored in legacy headers.
InclusionListSummaryRoot *common.Hash `json:"inclusionListSummaryRoot" rlp:"optional"`
} }
// field type overrides for gencodec // field type overrides for gencodec
@ -171,10 +168,9 @@ func (h *Header) EmptyReceipts() bool {
// Body is a simple (mutable, non-safe) data container for storing and moving // Body is a simple (mutable, non-safe) data container for storing and moving
// a block's data contents (transactions and uncles) together. // a block's data contents (transactions and uncles) together.
type Body struct { type Body struct {
Transactions []*Transaction Transactions []*Transaction
Uncles []*Header Uncles []*Header
Withdrawals []*Withdrawal `rlp:"optional"` Withdrawals []*Withdrawal `rlp:"optional"`
InclusionListSummary []common.Address
} }
// Block represents an Ethereum block. // Block represents an Ethereum block.
@ -195,11 +191,10 @@ type Body struct {
// - We do not copy body data on access because it does not affect the caches, and also // - We do not copy body data on access because it does not affect the caches, and also
// because it would be too expensive. // because it would be too expensive.
type Block struct { type Block struct {
header *Header header *Header
uncles []*Header uncles []*Header
transactions Transactions transactions Transactions
withdrawals Withdrawals withdrawals Withdrawals
inclusionListSummary []common.Address
// caches // caches
hash atomic.Value hash atomic.Value
@ -213,11 +208,10 @@ type Block struct {
// "external" block encoding. used for eth protocol, etc. // "external" block encoding. used for eth protocol, etc.
type extblock struct { type extblock struct {
Header *Header Header *Header
Txs []*Transaction Txs []*Transaction
Uncles []*Header Uncles []*Header
Withdrawals []*Withdrawal `rlp:"optional"` Withdrawals []*Withdrawal `rlp:"optional"`
InclusionListSummary []common.Address
} }
// NewBlock creates a new block. The input data is copied, changes to header and to the // NewBlock creates a new block. The input data is copied, changes to header and to the
@ -338,16 +332,15 @@ func (b *Block) EncodeRLP(w io.Writer) error {
// Body returns the non-header content of the block. // Body returns the non-header content of the block.
// Note the returned data is not an independent copy. // Note the returned data is not an independent copy.
func (b *Block) Body() *Body { func (b *Block) Body() *Body {
return &Body{b.transactions, b.uncles, b.withdrawals, b.inclusionListSummary} return &Body{b.transactions, b.uncles, b.withdrawals}
} }
// Accessors for body data. These do not return a copy because the content // Accessors for body data. These do not return a copy because the content
// of the body slices does not affect the cached hash/size in block. // of the body slices does not affect the cached hash/size in block.
func (b *Block) Uncles() []*Header { return b.uncles } func (b *Block) Uncles() []*Header { return b.uncles }
func (b *Block) Transactions() Transactions { return b.transactions } func (b *Block) Transactions() Transactions { return b.transactions }
func (b *Block) Withdrawals() Withdrawals { return b.withdrawals } func (b *Block) Withdrawals() Withdrawals { return b.withdrawals }
func (b *Block) InclusionListSummary() []common.Address { return b.inclusionListSummary }
func (b *Block) Transaction(hash common.Hash) *Transaction { func (b *Block) Transaction(hash common.Hash) *Transaction {
for _, transaction := range b.transactions { for _, transaction := range b.transactions {
@ -489,20 +482,6 @@ func (b *Block) WithWithdrawals(withdrawals []*Withdrawal) *Block {
return block return block
} }
// WithInclusionList returns a copy of the block containing the given inclusionList.
func (b *Block) WithInclusionList(addresses []common.Address) *Block {
block := &Block{
header: b.header,
transactions: b.transactions,
uncles: b.uncles,
}
if addresses != nil {
block.inclusionListSummary = make([]common.Address, len(addresses))
copy(block.inclusionListSummary, addresses)
}
return block
}
// Hash returns the keccak256 hash of b's header. // Hash returns the keccak256 hash of b's header.
// The hash is computed on the first call and cached thereafter. // The hash is computed on the first call and cached thereafter.
func (b *Block) Hash() common.Hash { func (b *Block) Hash() common.Hash {