mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-09 17:46:37 +00:00
This Pr implements some prerequisite changes for #34004 : split the `CachingDB` into a `MerkleDB` and a `UBTDB`, so that very different behaviors don't clash as much. The transition isn't handled by this PR, but after talking to Gary we agreed that `UBTDB` should receive another `triedb`, which will only be loaded if the `Ended` flag is set to false in the conversion contract. If this is too hard to achieve, it makes sense to load it regardless, and then loading can be prevented at a later stage by adding a `UBTTransitionFinalizationTime` in `ChainConfig`. --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com>
47 lines
1.8 KiB
Go
47 lines
1.8 KiB
Go
// Copyright 2023 The go-ethereum Authors
|
|
// This file is part of the go-ethereum library.
|
|
//
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package blobpool
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/core/state"
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
"github.com/ethereum/go-ethereum/params"
|
|
)
|
|
|
|
// BlockChain defines the minimal set of methods needed to back a blob pool with
|
|
// a chain. Exists to allow mocking the live chain out of tests.
|
|
type BlockChain interface {
|
|
// Config retrieves the chain's fork configuration.
|
|
Config() *params.ChainConfig
|
|
|
|
// CurrentBlock returns the current head of the chain.
|
|
CurrentBlock() *types.Header
|
|
|
|
// Genesis returns the genesis block of the chain.
|
|
Genesis() *types.Block
|
|
|
|
// CurrentFinalBlock returns the current block below which blobs should not
|
|
// be maintained anymore for reorg purposes.
|
|
CurrentFinalBlock() *types.Header
|
|
|
|
// GetBlock retrieves a specific block, used during pool resets.
|
|
GetBlock(hash common.Hash, number uint64) *types.Block
|
|
|
|
// StateAt returns a state database for a given chain header (generally the head).
|
|
StateAt(header *types.Header) (*state.StateDB, error)
|
|
}
|