Skip to content

Commit 10fdb2f

Browse files
committed
Update RPC to be an alias
1 parent e8a5edd commit 10fdb2f

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

eth/filters/api_subql.go

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/ethereum/go-ethereum/core/types"
1515
"github.com/ethereum/go-ethereum/internal/ethapi"
1616
"github.com/ethereum/go-ethereum/log"
17+
"github.com/ethereum/go-ethereum/params"
1718
"github.com/ethereum/go-ethereum/rpc"
1819
)
1920

@@ -61,11 +62,6 @@ type SubqlAPI struct {
6162
backend ethapi.Backend
6263
}
6364

64-
type DataInfo struct {
65-
StartBlock int `json:"startBlock"`
66-
EndBlock int `json:"endBlock"`
67-
}
68-
6965
type Capability struct {
7066
AvailableBlocks []struct {
7167
StartHeight int `json:"startHeight"`
@@ -123,23 +119,11 @@ func NewSubqlApi(sys *FilterSystem, backend ethapi.Backend) *SubqlAPI {
123119
return api
124120
}
125121

126-
func (api *SubqlAPI) DataInfo(ctx context.Context) (*DataInfo, error) {
122+
// This is an alias for `admin_getDesiredConfig`
123+
func (api *SubqlAPI) DataInfo(ctx context.Context) (*params.ChainDataConfig, error) {
127124
config := rawdb.ReadChainDataConfig(api.backend.ChainDb())
128125

129-
start := 0
130-
if config.DesiredChainDataStart != nil {
131-
start = int(*config.DesiredChainDataStart)
132-
}
133-
134-
end := 0
135-
if config.DesiredChainDataEnd != nil {
136-
end = int(*config.DesiredChainDataEnd)
137-
}
138-
139-
return &DataInfo{
140-
StartBlock: start,
141-
EndBlock: end,
142-
}, nil
126+
return config, nil
143127
}
144128

145129
func (api *SubqlAPI) FilterBlocksCapabilities(ctx context.Context) (*Capability, error) {

0 commit comments

Comments
 (0)