internal/ethapi: use genesis header instead of block object

This commit is contained in:
lightclient 2025-08-27 07:12:21 -06:00
parent 4a63b16bde
commit 815a841993
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
2 changed files with 4 additions and 4 deletions

View file

@ -1171,7 +1171,7 @@ type configResponse struct {
// Config implements the EIP-7910 eth_config method. // Config implements the EIP-7910 eth_config method.
func (api *BlockChainAPI) Config(ctx context.Context) (*configResponse, error) { func (api *BlockChainAPI) Config(ctx context.Context) (*configResponse, error) {
genesis, err := api.b.BlockByNumber(ctx, 0) genesis, err := api.b.HeaderByNumber(ctx, 0)
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to load genesis: %w", err) return nil, fmt.Errorf("unable to load genesis: %w", err)
} }
@ -1188,7 +1188,7 @@ func (api *BlockChainAPI) Config(ctx context.Context) (*configResponse, error) {
for addr, c := range vm.ActivePrecompiledContracts(rules) { for addr, c := range vm.ActivePrecompiledContracts(rules) {
precompiles[c.Name()] = addr precompiles[c.Name()] = addr
} }
forkid := forkid.NewID(c, genesis, ^uint64(0), t).Hash forkid := forkid.NewID(c, types.NewBlockWithHeader(genesis), ^uint64(0), t).Hash
return &config{ return &config{
ActivationTime: t, ActivationTime: t,
BlobSchedule: c.BlobConfig(c.LatestFork(t)), BlobSchedule: c.BlobConfig(c.LatestFork(t)),

View file

@ -3842,9 +3842,9 @@ func (b configTimeBackend) ChainConfig() *params.ChainConfig {
return b.genesis.Config return b.genesis.Config
} }
func (b configTimeBackend) BlockByNumber(_ context.Context, n rpc.BlockNumber) (*types.Block, error) { func (b configTimeBackend) HeaderByNumber(_ context.Context, n rpc.BlockNumber) (*types.Header, error) {
if n == 0 { if n == 0 {
return b.genesis.ToBlock(), nil return b.genesis.ToBlock().Header(), nil
} }
panic("not implemented") panic("not implemented")
} }