From 358c674c704e73ad3651acf966fc5c49777e943c Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Tue, 17 Sep 2024 19:36:33 +0200 Subject: [PATCH] rm unused geth_fork api method --- internal/ethapi/api.go | 19 ------------------- internal/ethapi/backend.go | 3 --- internal/web3ext/web3ext.go | 15 --------------- 3 files changed, 37 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index a127f4f2be..1c3cb4adf9 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2164,25 +2164,6 @@ func (api *NetAPI) Version() string { return fmt.Sprintf("%d", api.networkVersion) } -// GethAPI offers geth-specific API methods. -type GethAPI struct { - b Backend -} - -// NewGethAPI creates a new net API instance. -func NewGethAPI(b Backend) *GethAPI { - return &GethAPI{b: b} -} - -// Fork returns the latest enabled fork as of the given block. -func (api *GethAPI) Fork(ctx context.Context, num rpc.BlockNumber) (string, error) { - b, err := api.b.BlockByNumber(ctx, num) - if err != nil { - return "", fmt.Errorf("block #%d not found", num) - } - return api.b.ChainConfig().LatestFork(b.Number(), b.Time()).String(), nil -} - // checkTxFee is an internal function used to check whether the fee of // the given transaction is _reasonable_(under the cap). func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error { diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 55cbe6b67c..2a45ba0921 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -123,9 +123,6 @@ func GetAPIs(apiBackend Backend) []rpc.API { }, { Namespace: "personal", Service: NewPersonalAccountAPI(apiBackend, nonceLock), - }, { - Namespace: "geth", - Service: NewGethAPI(apiBackend), }, } } diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index a9e3b45f32..4a1a37d722 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -31,7 +31,6 @@ var Modules = map[string]string{ "les": LESJs, "vflux": VfluxJs, "dev": DevJs, - "geth": GethJs, } const CliqueJs = ` @@ -888,17 +887,3 @@ web3._extend({ ], }); ` - -const GethJs = ` -web3._extend({ - property: 'geth', - methods: - [ - new web3._extend.Method({ - name: 'fork', - call: 'geth_fork', - params: 1 - }), - ], -}); -`