flags_legacy.go 6.6 KB

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