mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
core/types: don't include BAL in rlp encoding of full block. Set access list hash on block header when calling 'Block.WithAccessList'
This commit is contained in:
parent
2ff40c7484
commit
e4f847871b
1 changed files with 8 additions and 5 deletions
|
|
@ -224,8 +224,7 @@ type extblock struct {
|
||||||
Header *Header
|
Header *Header
|
||||||
Txs []*Transaction
|
Txs []*Transaction
|
||||||
Uncles []*Header
|
Uncles []*Header
|
||||||
Withdrawals []*Withdrawal `rlp:"optional"`
|
Withdrawals []*Withdrawal `rlp:"optional"`
|
||||||
AccessList *bal.BlockAccessList `rlp:"optional"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -353,7 +352,7 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error {
|
||||||
if err := s.Decode(&eb); err != nil {
|
if err := s.Decode(&eb); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b.header, b.uncles, b.transactions, b.withdrawals, b.accessList = eb.Header, eb.Uncles, eb.Txs, eb.Withdrawals, eb.AccessList
|
b.header, b.uncles, b.transactions, b.withdrawals = eb.Header, eb.Uncles, eb.Txs, eb.Withdrawals
|
||||||
b.size.Store(rlp.ListSize(size))
|
b.size.Store(rlp.ListSize(size))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +364,6 @@ func (b *Block) EncodeRLP(w io.Writer) error {
|
||||||
Txs: b.transactions,
|
Txs: b.transactions,
|
||||||
Uncles: b.uncles,
|
Uncles: b.uncles,
|
||||||
Withdrawals: b.withdrawals,
|
Withdrawals: b.withdrawals,
|
||||||
AccessList: b.accessList,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,8 +541,13 @@ func (b *Block) WithAccessList(accessList *bal.BlockAccessList) *Block {
|
||||||
// embedded. Note that the access list is not deep-copied; use WithAccessList
|
// embedded. Note that the access list is not deep-copied; use WithAccessList
|
||||||
// if the provided list may be modified by other actors.
|
// if the provided list may be modified by other actors.
|
||||||
func (b *Block) WithAccessListUnsafe(accessList *bal.BlockAccessList) *Block {
|
func (b *Block) WithAccessListUnsafe(accessList *bal.BlockAccessList) *Block {
|
||||||
|
headerCopy := CopyHeader(b.header)
|
||||||
|
if accessList != nil {
|
||||||
|
alHash := accessList.Hash()
|
||||||
|
headerCopy.BlockAccessListHash = &alHash
|
||||||
|
}
|
||||||
return &Block{
|
return &Block{
|
||||||
header: b.header,
|
header: headerCopy,
|
||||||
transactions: b.transactions,
|
transactions: b.transactions,
|
||||||
uncles: b.uncles,
|
uncles: b.uncles,
|
||||||
withdrawals: b.withdrawals,
|
withdrawals: b.withdrawals,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue