cmd/geth, cmd/utils: remove legacy rpc flags (#23358)

* remove rpc flags

* remove legacy rpc flags

* remove legacy rpc flags

* remove legacy rpc commands

* (hopefully) fix most of the build errors

* fix build errors

https://app.travis-ci.com/github/ethereum/go-ethereum/jobs/530318686

* cmd/utils: fix syntax error

* empty commit to unbreak travis ci

* fix syntax error

* syntax fixes

* syntax fixes

* fix

fixes "cmd/geth/usage.go:234:7: expected '(', found init (typecheck)"

* fix

* various fixes in usage.go

* various fixes in flags.go

* adds extra space

reverts the spacing to how it was before I resolved the merge conflict

* more fixes in usage.go

* fix

fix for cmd/geth/usage.go:243:17: expected operand, found ':=' (typecheck) in travis

* Update cmd/utils/flags.go

Co-authored-by: Martin Holst Swende <martin@swende.se>

* fix error

 fixes these errors:
cmd/utils/flags_legacy.go:21:2: "strings" imported but not used (typecheck)

	"strings"

	^

cmd/utils/flags_legacy.go:24:2: "github.com/ethereum/go-ethereum/node" imported but not used (typecheck)

	"github.com/ethereum/go-ethereum/node"

	^

* goimports

Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
Zachinquarantine 2021-09-07 04:52:58 -04:00 committed by GitHub
parent ca5bc676d1
commit 9a0df80bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 68 deletions

View File

@ -158,12 +158,6 @@ var (
utils.HTTPPortFlag, utils.HTTPPortFlag,
utils.HTTPCORSDomainFlag, utils.HTTPCORSDomainFlag,
utils.HTTPVirtualHostsFlag, utils.HTTPVirtualHostsFlag,
utils.LegacyRPCEnabledFlag,
utils.LegacyRPCListenAddrFlag,
utils.LegacyRPCPortFlag,
utils.LegacyRPCCORSDomainFlag,
utils.LegacyRPCVirtualHostsFlag,
utils.LegacyRPCApiFlag,
utils.GraphQLEnabledFlag, utils.GraphQLEnabledFlag,
utils.GraphQLCORSDomainFlag, utils.GraphQLCORSDomainFlag,
utils.GraphQLVirtualHostsFlag, utils.GraphQLVirtualHostsFlag,

View File

@ -218,13 +218,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
Name: "ALIASED (deprecated)", Name: "ALIASED (deprecated)",
Flags: []cli.Flag{ Flags: []cli.Flag{
utils.NoUSBFlag, utils.NoUSBFlag,
utils.LegacyRPCEnabledFlag,
utils.LegacyRPCListenAddrFlag,
utils.LegacyRPCPortFlag,
utils.LegacyRPCCORSDomainFlag,
utils.LegacyRPCVirtualHostsFlag,
utils.LegacyRPCApiFlag,
utils.LegacyMinerGasTargetFlag,
}, },
}, },
{ {

View File

@ -920,14 +920,6 @@ func SplitAndTrim(input string) (ret []string) {
// setHTTP creates the HTTP RPC listener interface string from the set // setHTTP creates the HTTP RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled. // command line flags, returning empty if the HTTP endpoint is disabled.
func setHTTP(ctx *cli.Context, cfg *node.Config) { func setHTTP(ctx *cli.Context, cfg *node.Config) {
if ctx.GlobalBool(LegacyRPCEnabledFlag.Name) && cfg.HTTPHost == "" {
log.Warn("The flag --rpc is deprecated and will be removed June 2021, please use --http")
cfg.HTTPHost = "127.0.0.1"
if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) {
cfg.HTTPHost = ctx.GlobalString(LegacyRPCListenAddrFlag.Name)
log.Warn("The flag --rpcaddr is deprecated and will be removed June 2021, please use --http.addr")
}
}
if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" { if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
cfg.HTTPHost = "127.0.0.1" cfg.HTTPHost = "127.0.0.1"
if ctx.GlobalIsSet(HTTPListenAddrFlag.Name) { if ctx.GlobalIsSet(HTTPListenAddrFlag.Name) {
@ -935,34 +927,18 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
} }
} }
if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) {
cfg.HTTPPort = ctx.GlobalInt(LegacyRPCPortFlag.Name)
log.Warn("The flag --rpcport is deprecated and will be removed June 2021, please use --http.port")
}
if ctx.GlobalIsSet(HTTPPortFlag.Name) { if ctx.GlobalIsSet(HTTPPortFlag.Name) {
cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name) cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name)
} }
if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) {
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name))
log.Warn("The flag --rpccorsdomain is deprecated and will be removed June 2021, please use --http.corsdomain")
}
if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) { if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) {
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name)) cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name))
} }
if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) {
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name))
log.Warn("The flag --rpcapi is deprecated and will be removed June 2021, please use --http.api")
}
if ctx.GlobalIsSet(HTTPApiFlag.Name) { if ctx.GlobalIsSet(HTTPApiFlag.Name) {
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name)) cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name))
} }
if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) {
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name))
log.Warn("The flag --rpcvhosts is deprecated and will be removed June 2021, please use --http.vhosts")
}
if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) { if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) {
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name)) cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name))
} }

View File

@ -18,10 +18,8 @@ package utils
import ( import (
"fmt" "fmt"
"strings"
"github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/node"
"gopkg.in/urfave/cli.v1" "gopkg.in/urfave/cli.v1"
) )
@ -45,35 +43,6 @@ var (
Name: "nousb", Name: "nousb",
Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)", Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)",
} }
LegacyRPCEnabledFlag = cli.BoolFlag{
Name: "rpc",
Usage: "Enable the HTTP-RPC server (deprecated and will be removed June 2021, use --http)",
}
LegacyRPCListenAddrFlag = cli.StringFlag{
Name: "rpcaddr",
Usage: "HTTP-RPC server listening interface (deprecated and will be removed June 2021, use --http.addr)",
Value: node.DefaultHTTPHost,
}
LegacyRPCPortFlag = cli.IntFlag{
Name: "rpcport",
Usage: "HTTP-RPC server listening port (deprecated and will be removed June 2021, use --http.port)",
Value: node.DefaultHTTPPort,
}
LegacyRPCCORSDomainFlag = cli.StringFlag{
Name: "rpccorsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated and will be removed June 2021, use --http.corsdomain)",
Value: "",
}
LegacyRPCVirtualHostsFlag = cli.StringFlag{
Name: "rpcvhosts",
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated and will be removed June 2021, use --http.vhosts)",
Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
}
LegacyRPCApiFlag = cli.StringFlag{
Name: "rpcapi",
Usage: "API's offered over the HTTP-RPC interface (deprecated and will be removed June 2021, use --http.api)",
Value: "",
}
// (Deprecated July 2021, shown in aliased flags section) // (Deprecated July 2021, shown in aliased flags section)
LegacyMinerGasTargetFlag = cli.Uint64Flag{ LegacyMinerGasTargetFlag = cli.Uint64Flag{
Name: "miner.gastarget", Name: "miner.gastarget",