From 6a035d211c9a74224624ff292fd09f6e9e692908 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Tue, 10 Sep 2024 16:34:16 +1200 Subject: [PATCH] Update RPC to be an alias --- eth/filters/api_subql.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/eth/filters/api_subql.go b/eth/filters/api_subql.go index b48d90bd299e..cf705a104f56 100644 --- a/eth/filters/api_subql.go +++ b/eth/filters/api_subql.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -61,11 +62,6 @@ type SubqlAPI struct { backend ethapi.Backend } -type DataInfo struct { - StartBlock int `json:"startBlock"` - EndBlock int `json:"endBlock"` -} - type Capability struct { AvailableBlocks []struct { StartHeight int `json:"startHeight"` @@ -123,23 +119,11 @@ func NewSubqlApi(sys *FilterSystem, backend ethapi.Backend) *SubqlAPI { return api } -func (api *SubqlAPI) DataInfo(ctx context.Context) (*DataInfo, error) { +// This is an alias for `admin_getDesiredConfig` +func (api *SubqlAPI) DataInfo(ctx context.Context) (*params.ChainDataConfig, error) { config := rawdb.ReadChainDataConfig(api.backend.ChainDb()) - start := 0 - if config.DesiredChainDataStart != nil { - start = int(*config.DesiredChainDataStart) - } - - end := 0 - if config.DesiredChainDataEnd != nil { - end = int(*config.DesiredChainDataEnd) - } - - return &DataInfo{ - StartBlock: start, - EndBlock: end, - }, nil + return config, nil } func (api *SubqlAPI) FilterBlocksCapabilities(ctx context.Context) (*Capability, error) {