github.com/CommerciumBlockchain/go-commercium@v0.0.0-20220709212705-b46438a77516/cmd/utils/flags_legacy.go (about)

     1  // Copyright 2020 The go-ethereum Authors
     2  // This file is part of go-ethereum.
     3  //
     4  // go-ethereum is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // go-ethereum is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU General Public License
    15  // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package utils
    18  
    19  import (
    20  	"fmt"
    21  	"strings"
    22  
    23  	"github.com/CommerciumBlockchain/go-commercium/eth"
    24  	"github.com/CommerciumBlockchain/go-commercium/node"
    25  	"gopkg.in/urfave/cli.v1"
    26  )
    27  
    28  var ShowDeprecated = cli.Command{
    29  	Action:      showDeprecated,
    30  	Name:        "show-deprecated-flags",
    31  	Usage:       "Show flags that have been deprecated",
    32  	ArgsUsage:   " ",
    33  	Category:    "MISCELLANEOUS COMMANDS",
    34  	Description: "Show flags that have been deprecated and will soon be removed",
    35  }
    36  
    37  var DeprecatedFlags = []cli.Flag{
    38  	LegacyTestnetFlag,
    39  	LegacyLightServFlag,
    40  	LegacyLightPeersFlag,
    41  	LegacyMinerThreadsFlag,
    42  	LegacyMinerGasTargetFlag,
    43  	LegacyMinerGasPriceFlag,
    44  	LegacyMinerEtherbaseFlag,
    45  	LegacyMinerExtraDataFlag,
    46  }
    47  
    48  var (
    49  	// (Deprecated April 2018)
    50  	LegacyMinerThreadsFlag = cli.IntFlag{
    51  		Name:  "minerthreads",
    52  		Usage: "Number of CPU threads to use for mining (deprecated, use --miner.threads)",
    53  		Value: 0,
    54  	}
    55  	LegacyMinerGasTargetFlag = cli.Uint64Flag{
    56  		Name:  "targetgaslimit",
    57  		Usage: "Target gas floor for mined blocks (deprecated, use --miner.gastarget)",
    58  		Value: eth.DefaultConfig.Miner.GasFloor,
    59  	}
    60  	LegacyMinerGasPriceFlag = BigFlag{
    61  		Name:  "gasprice",
    62  		Usage: "Minimum gas price for mining a transaction (deprecated, use --miner.gasprice)",
    63  		Value: eth.DefaultConfig.Miner.GasPrice,
    64  	}
    65  	LegacyMinerEtherbaseFlag = cli.StringFlag{
    66  		Name:  "etherbase",
    67  		Usage: "Public address for block mining rewards (default = first account, deprecated, use --miner.etherbase)",
    68  		Value: "0",
    69  	}
    70  	LegacyMinerExtraDataFlag = cli.StringFlag{
    71  		Name:  "extradata",
    72  		Usage: "Block extra data set by the miner (default = client version, deprecated, use --miner.extradata)",
    73  	}
    74  
    75  	// (Deprecated June 2019)
    76  	LegacyLightServFlag = cli.IntFlag{
    77  		Name:  "lightserv",
    78  		Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)",
    79  		Value: eth.DefaultConfig.LightServ,
    80  	}
    81  	LegacyLightPeersFlag = cli.IntFlag{
    82  		Name:  "lightpeers",
    83  		Usage: "Maximum number of light clients to serve, or light servers to attach to  (deprecated, use --light.maxpeers)",
    84  		Value: eth.DefaultConfig.LightPeers,
    85  	}
    86  
    87  	// (Deprecated April 2020)
    88  	LegacyTestnetFlag = cli.BoolFlag{ // TODO(q9f): Remove after Ropsten is discontinued.
    89  		Name:  "testnet",
    90  		Usage: "Pre-configured test network (Deprecated: Please choose one of --goerli, --rinkeby, or --ropsten.)",
    91  	}
    92  
    93  	// (Deprecated May 2020, shown in aliased flags section)
    94  	LegacyRPCEnabledFlag = cli.BoolFlag{
    95  		Name:  "rpc",
    96  		Usage: "Enable the HTTP-RPC server (deprecated, use --http)",
    97  	}
    98  	LegacyRPCListenAddrFlag = cli.StringFlag{
    99  		Name:  "rpcaddr",
   100  		Usage: "HTTP-RPC server listening interface (deprecated, use --http.addr)",
   101  		Value: node.DefaultHTTPHost,
   102  	}
   103  	LegacyRPCPortFlag = cli.IntFlag{
   104  		Name:  "rpcport",
   105  		Usage: "HTTP-RPC server listening port (deprecated, use --http.port)",
   106  		Value: node.DefaultHTTPPort,
   107  	}
   108  	LegacyRPCCORSDomainFlag = cli.StringFlag{
   109  		Name:  "rpccorsdomain",
   110  		Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated, use --http.corsdomain)",
   111  		Value: "",
   112  	}
   113  	LegacyRPCVirtualHostsFlag = cli.StringFlag{
   114  		Name:  "rpcvhosts",
   115  		Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated, use --http.vhosts)",
   116  		Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
   117  	}
   118  	LegacyRPCApiFlag = cli.StringFlag{
   119  		Name:  "rpcapi",
   120  		Usage: "API's offered over the HTTP-RPC interface (deprecated, use --http.api)",
   121  		Value: "",
   122  	}
   123  	LegacyWSListenAddrFlag = cli.StringFlag{
   124  		Name:  "wsaddr",
   125  		Usage: "WS-RPC server listening interface (deprecated, use --ws.addr)",
   126  		Value: node.DefaultWSHost,
   127  	}
   128  	LegacyWSPortFlag = cli.IntFlag{
   129  		Name:  "wsport",
   130  		Usage: "WS-RPC server listening port (deprecated, use --ws.port)",
   131  		Value: node.DefaultWSPort,
   132  	}
   133  	LegacyWSApiFlag = cli.StringFlag{
   134  		Name:  "wsapi",
   135  		Usage: "API's offered over the WS-RPC interface (deprecated, use --ws.api)",
   136  		Value: "",
   137  	}
   138  	LegacyWSAllowedOriginsFlag = cli.StringFlag{
   139  		Name:  "wsorigins",
   140  		Usage: "Origins from which to accept websockets requests (deprecated, use --ws.origins)",
   141  		Value: "",
   142  	}
   143  	LegacyGpoBlocksFlag = cli.IntFlag{
   144  		Name:  "gpoblocks",
   145  		Usage: "Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks)",
   146  		Value: eth.DefaultConfig.GPO.Blocks,
   147  	}
   148  	LegacyGpoPercentileFlag = cli.IntFlag{
   149  		Name:  "gpopercentile",
   150  		Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)",
   151  		Value: eth.DefaultConfig.GPO.Percentile,
   152  	}
   153  	LegacyBootnodesV4Flag = cli.StringFlag{
   154  		Name:  "bootnodesv4",
   155  		Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes) (deprecated, use --bootnodes)",
   156  		Value: "",
   157  	}
   158  	LegacyBootnodesV5Flag = cli.StringFlag{
   159  		Name:  "bootnodesv5",
   160  		Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes) (deprecated, use --bootnodes)",
   161  		Value: "",
   162  	}
   163  
   164  	// (Deprecated July 2020, shown in aliased flags section)
   165  	LegacyGraphQLListenAddrFlag = cli.StringFlag{
   166  		Name:  "graphql.addr",
   167  		Usage: "GraphQL server listening interface (deprecated, graphql can only be enabled on the HTTP-RPC server endpoint, use --graphql)",
   168  	}
   169  	LegacyGraphQLPortFlag = cli.IntFlag{
   170  		Name:  "graphql.port",
   171  		Usage: "GraphQL server listening port (deprecated, graphql can only be enabled on the HTTP-RPC server endpoint, use --graphql)",
   172  		Value: node.DefaultHTTPPort,
   173  	}
   174  )
   175  
   176  // showDeprecated displays deprecated flags that will be soon removed from the codebase.
   177  func showDeprecated(*cli.Context) {
   178  	fmt.Println("--------------------------------------------------------------------")
   179  	fmt.Println("The following flags are deprecated and will be removed in the future!")
   180  	fmt.Println("--------------------------------------------------------------------")
   181  	fmt.Println()
   182  
   183  	for _, flag := range DeprecatedFlags {
   184  		fmt.Println(flag.String())
   185  	}
   186  }