Remove unused backend

This commit is contained in:
crypto-services 2024-02-15 16:45:06 +08:00
parent bb6215bce5
commit 3ded1c14c3
3 changed files with 6 additions and 7 deletions

View file

@ -197,7 +197,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
filterSystem := utils.RegisterFilterAPI(stack, backend, &cfg.Eth)
// TODO: ENG191 add flag to request endpoint
utils.RegisterHealthService(stack, backend, &cfg.Node)
utils.RegisterHealthService(stack, &cfg.Node)
// Configure GraphQL if requested.
if ctx.IsSet(utils.GraphQLEnabledFlag.Name) {

View file

@ -1885,8 +1885,8 @@ func RegisterGraphQLService(stack *node.Node, backend ethapi.Backend, filterSyst
}
// RegisterHealthService adds the Health API to the node.
func RegisterHealthService(stack *node.Node, backend ethapi.Backend, cfg *node.Config) {
err := health.New(stack, backend, cfg.HTTPCors, cfg.HTTPVirtualHosts)
func RegisterHealthService(stack *node.Node, cfg *node.Config) {
err := health.New(stack, cfg.HTTPCors, cfg.HTTPVirtualHosts)
if err != nil {
Fatalf("Failed to register the health service: %v", err)
}

View file

@ -4,7 +4,6 @@ import (
"net/http"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/node"
)
@ -22,13 +21,13 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// New constructs a new health service instance.
func New(stack *node.Node, backend ethapi.Backend, cors, vhosts []string) error {
_, err := newHandler(stack, backend, cors, vhosts)
func New(stack *node.Node, cors, vhosts []string) error {
_, err := newHandler(stack, cors, vhosts)
return err
}
// newHandler returns a new `http.Handler` that will answer node health queries.
func newHandler(stack *node.Node, backend ethapi.Backend, cors, vhosts []string) (*handler, error) {
func newHandler(stack *node.Node, cors, vhosts []string) (*handler, error) {
ec := ethclient.NewClient(stack.Attach())
h := handler{ec}
handler := node.NewHTTPHandlerStack(h, cors, vhosts, nil)