github.com/ethereum/go-ethereum@v1.16.1/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  
    22  	"github.com/ethereum/go-ethereum/eth/ethconfig"
    23  	"github.com/ethereum/go-ethereum/internal/flags"
    24  	"github.com/urfave/cli/v2"
    25  )
    26  
    27  var ShowDeprecated = &cli.Command{
    28  	Action:      showDeprecated,
    29  	Name:        "show-deprecated-flags",
    30  	Usage:       "Show flags that have been deprecated",
    31  	ArgsUsage:   " ",
    32  	Description: "Show flags that have been deprecated and will soon be removed",
    33  }
    34  
    35  var DeprecatedFlags = []cli.Flag{
    36  	NoUSBFlag,
    37  	LegacyWhitelistFlag,
    38  	CacheTrieJournalFlag,
    39  	CacheTrieRejournalFlag,
    40  	LegacyDiscoveryV5Flag,
    41  	TxLookupLimitFlag,
    42  	LogBacktraceAtFlag,
    43  	LogDebugFlag,
    44  	MinerNewPayloadTimeoutFlag,
    45  	MinerEtherbaseFlag,
    46  	MiningEnabledFlag,
    47  }
    48  
    49  var (
    50  	// Deprecated May 2020, shown in aliased flags section
    51  	NoUSBFlag = &cli.BoolFlag{
    52  		Name:     "nousb",
    53  		Usage:    "Disables monitoring for and managing USB hardware wallets (deprecated)",
    54  		Category: flags.DeprecatedCategory,
    55  	}
    56  	// Deprecated March 2022
    57  	LegacyWhitelistFlag = &cli.StringFlag{
    58  		Name:     "whitelist",
    59  		Usage:    "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)",
    60  		Category: flags.DeprecatedCategory,
    61  	}
    62  	// Deprecated July 2023
    63  	CacheTrieJournalFlag = &cli.StringFlag{
    64  		Name:     "cache.trie.journal",
    65  		Usage:    "Disk journal directory for trie cache to survive node restarts",
    66  		Category: flags.DeprecatedCategory,
    67  	}
    68  	CacheTrieRejournalFlag = &cli.DurationFlag{
    69  		Name:     "cache.trie.rejournal",
    70  		Usage:    "Time interval to regenerate the trie cache journal",
    71  		Category: flags.DeprecatedCategory,
    72  	}
    73  	LegacyDiscoveryV5Flag = &cli.BoolFlag{
    74  		Name:     "v5disc",
    75  		Usage:    "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)",
    76  		Category: flags.DeprecatedCategory,
    77  	}
    78  	// Deprecated August 2023
    79  	TxLookupLimitFlag = &cli.Uint64Flag{
    80  		Name:     "txlookuplimit",
    81  		Usage:    "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (deprecated, use history.transactions instead)",
    82  		Value:    ethconfig.Defaults.TransactionHistory,
    83  		Category: flags.DeprecatedCategory,
    84  	}
    85  	// Deprecated November 2023
    86  	LogBacktraceAtFlag = &cli.StringFlag{
    87  		Name:     "log.backtrace",
    88  		Usage:    "Request a stack trace at a specific logging statement (deprecated)",
    89  		Value:    "",
    90  		Category: flags.DeprecatedCategory,
    91  	}
    92  	LogDebugFlag = &cli.BoolFlag{
    93  		Name:     "log.debug",
    94  		Usage:    "Prepends log messages with call-site location (deprecated)",
    95  		Category: flags.DeprecatedCategory,
    96  	}
    97  	// Deprecated February 2024
    98  	MinerNewPayloadTimeoutFlag = &cli.DurationFlag{
    99  		Name:     "miner.newpayload-timeout",
   100  		Usage:    "Specify the maximum time allowance for creating a new payload (deprecated)",
   101  		Value:    ethconfig.Defaults.Miner.Recommit,
   102  		Category: flags.DeprecatedCategory,
   103  	}
   104  	MinerEtherbaseFlag = &cli.StringFlag{
   105  		Name:     "miner.etherbase",
   106  		Usage:    "0x prefixed public address for block mining rewards (deprecated)",
   107  		Category: flags.DeprecatedCategory,
   108  	}
   109  	MiningEnabledFlag = &cli.BoolFlag{
   110  		Name:     "mine",
   111  		Usage:    "Enable mining (deprecated)",
   112  		Category: flags.DeprecatedCategory,
   113  	}
   114  	MetricsEnabledExpensiveFlag = &cli.BoolFlag{
   115  		Name:     "metrics.expensive",
   116  		Usage:    "Enable expensive metrics collection and reporting (deprecated)",
   117  		Category: flags.DeprecatedCategory,
   118  	}
   119  	// Deprecated Oct 2024
   120  	EnablePersonal = &cli.BoolFlag{
   121  		Name:     "rpc.enabledeprecatedpersonal",
   122  		Usage:    "This used to enable the 'personal' namespace.",
   123  		Category: flags.DeprecatedCategory,
   124  	}
   125  	UnlockedAccountFlag = &cli.StringFlag{
   126  		Name:     "unlock",
   127  		Usage:    "Comma separated list of accounts to unlock (deprecated)",
   128  		Value:    "",
   129  		Category: flags.DeprecatedCategory,
   130  	}
   131  	InsecureUnlockAllowedFlag = &cli.BoolFlag{
   132  		Name:     "allow-insecure-unlock",
   133  		Usage:    "Allow insecure account unlocking when account-related RPCs are exposed by http (deprecated)",
   134  		Category: flags.DeprecatedCategory,
   135  	}
   136  )
   137  
   138  // showDeprecated displays deprecated flags that will be soon removed from the codebase.
   139  func showDeprecated(*cli.Context) error {
   140  	fmt.Println("--------------------------------------------------------------------")
   141  	fmt.Println("The following flags are deprecated and will be removed in the future!")
   142  	fmt.Println("--------------------------------------------------------------------")
   143  	fmt.Println()
   144  	for _, flag := range DeprecatedFlags {
   145  		fmt.Println(flag.String())
   146  	}
   147  	fmt.Println()
   148  	return nil
   149  }