internal/web3ext, node: migrate node admin API (Start|Stop)RPC->HTTP (#22461)

* internal/web3ext,node: migrate node admin API (Start|Stop)RPC->HTTP

Corresponding CLI flags --rpc have been moved to --http.

This moves the admin module HTTP RPC start/stop
methods to an equivalent namespace.

Rel https://github.com/ethereum/go-ethereum/pull/22263

Date: 2021-03-08 08:00:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* internal/web3ext: fix startRPC/HTTP param count (4->5)

Date: 2021-03-16 06:13:23-05:00
Signed-off-by: meows <b5c6@protonmail.com>
This commit is contained in:
meowsbits
2021-03-23 04:41:23 -05:00
committed by GitHub
parent 477ec75323
commit e862cbff95
3 changed files with 43 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/internal/debug"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
@@ -162,8 +163,8 @@ func (api *privateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription,
return rpcSub, nil
}
// StartRPC starts the HTTP RPC API server.
func (api *privateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
// StartHTTP starts the HTTP RPC API server.
func (api *privateAdminAPI) StartHTTP(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
api.node.lock.Lock()
defer api.node.lock.Unlock()
@@ -216,12 +217,26 @@ func (api *privateAdminAPI) StartRPC(host *string, port *int, cors *string, apis
return true, nil
}
// StopRPC shuts down the HTTP server.
func (api *privateAdminAPI) StopRPC() (bool, error) {
// StartRPC starts the HTTP RPC API server.
// This method is deprecated. Use StartHTTP instead.
func (api *privateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
log.Warn("Deprecation warning", "method", "admin.StartRPC", "use-instead", "admin.StartHTTP")
return api.StartHTTP(host, port, cors, apis, vhosts)
}
// StopHTTP shuts down the HTTP server.
func (api *privateAdminAPI) StopHTTP() (bool, error) {
api.node.http.stop()
return true, nil
}
// StopRPC shuts down the HTTP server.
// This method is deprecated. Use StopHTTP instead.
func (api *privateAdminAPI) StopRPC() (bool, error) {
log.Warn("Deprecation warning", "method", "admin.StopRPC", "use-instead", "admin.StopHTTP")
return api.StopHTTP()
}
// StartWS starts the websocket RPC API server.
func (api *privateAdminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error) {
api.node.lock.Lock()