persist access list correctly

This commit is contained in:
Jared Wasinger 2026-02-03 14:52:06 -05:00 committed by MariusVanDerWijden
parent 206eb81148
commit 2266891ece

View file

@ -693,15 +693,12 @@ func ReadBlock(db ethdb.Reader, hash common.Hash, number uint64) *types.Block {
block := types.NewBlockWithHeader(header).WithBody(*body) block := types.NewBlockWithHeader(header).WithBody(*body)
// TODO: only read the access list if the bal hash is set in the header. if header.BlockAccessListHash != nil {
// I do it here regardless in order to support --experimental.bal which accessList := ReadAccessList(db, hash, number)
// doesn't expect bal hash to be set in header in order to be compatible if accessList != nil {
// with importing mainnet blocks augmented with BALs block = block.WithAccessList(accessList)
accessList := ReadAccessList(db, hash, number) }
if accessList != nil {
block = block.WithAccessList(accessList)
} }
return block return block
} }
@ -709,6 +706,9 @@ func ReadBlock(db ethdb.Reader, hash common.Hash, number uint64) *types.Block {
func WriteBlock(db ethdb.KeyValueWriter, block *types.Block) { func WriteBlock(db ethdb.KeyValueWriter, block *types.Block) {
WriteBody(db, block.Hash(), block.NumberU64(), block.Body()) WriteBody(db, block.Hash(), block.NumberU64(), block.Body())
WriteHeader(db, block.Header()) WriteHeader(db, block.Header())
if block.AccessList() != nil {
WriteAccessList(db, block.Hash(), block.NumberU64(), block.AccessList())
}
} }
// WriteAncientBlocks writes entire block data into ancient store and returns the total written size. // WriteAncientBlocks writes entire block data into ancient store and returns the total written size.