github.com/DxChainNetwork/dxc@v0.8.1-0.20220824085222-1162e304b6e7/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/DxChainNetwork/dxc/eth/ethconfig"
    24  	"github.com/DxChainNetwork/dxc/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  	LegacyMinerGasTargetFlag,
    39  	NoUSBFlag,
    40  }
    41  
    42  var (
    43  	// (Deprecated May 2020, shown in aliased flags section)
    44  	NoUSBFlag = cli.BoolFlag{
    45  		Name:  "nousb",
    46  		Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)",
    47  	}
    48  	LegacyRPCEnabledFlag = cli.BoolFlag{
    49  		Name:  "rpc",
    50  		Usage: "Enable the HTTP-RPC server (deprecated and will be removed June 2021, use --http)",
    51  	}
    52  	LegacyRPCListenAddrFlag = cli.StringFlag{
    53  		Name:  "rpcaddr",
    54  		Usage: "HTTP-RPC server listening interface (deprecated and will be removed June 2021, use --http.addr)",
    55  		Value: node.DefaultHTTPHost,
    56  	}
    57  	LegacyRPCPortFlag = cli.IntFlag{
    58  		Name:  "rpcport",
    59  		Usage: "HTTP-RPC server listening port (deprecated and will be removed June 2021, use --http.port)",
    60  		Value: node.DefaultHTTPPort,
    61  	}
    62  	LegacyRPCCORSDomainFlag = cli.StringFlag{
    63  		Name:  "rpccorsdomain",
    64  		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)",
    65  		Value: "",
    66  	}
    67  	LegacyRPCVirtualHostsFlag = cli.StringFlag{
    68  		Name:  "rpcvhosts",
    69  		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)",
    70  		Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
    71  	}
    72  	LegacyRPCApiFlag = cli.StringFlag{
    73  		Name:  "rpcapi",
    74  		Usage: "API's offered over the HTTP-RPC interface (deprecated and will be removed June 2021, use --http.api)",
    75  		Value: "",
    76  	}
    77  	// (Deprecated July 2021, shown in aliased flags section)
    78  	LegacyMinerGasTargetFlag = cli.Uint64Flag{
    79  		Name:  "miner.gastarget",
    80  		Usage: "Target gas floor for mined blocks (deprecated)",
    81  		Value: ethconfig.Defaults.Miner.GasFloor,
    82  	}
    83  )
    84  
    85  // showDeprecated displays deprecated flags that will be soon removed from the codebase.
    86  func showDeprecated(*cli.Context) {
    87  	fmt.Println("--------------------------------------------------------------------")
    88  	fmt.Println("The following flags are deprecated and will be removed in the future!")
    89  	fmt.Println("--------------------------------------------------------------------")
    90  	fmt.Println()
    91  	for _, flag := range DeprecatedFlags {
    92  		fmt.Println(flag.String())
    93  	}
    94  	fmt.Println()
    95  }