mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
fixed circular import
This commit is contained in:
parent
2f4386a0da
commit
d9437678a6
4 changed files with 43 additions and 51 deletions
|
|
@ -20,7 +20,6 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/big"
|
||||
"os"
|
||||
"runtime"
|
||||
godebug "runtime/debug"
|
||||
|
|
@ -459,24 +458,19 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||
utils.Fatalf("Ethereum service not running: %v", err)
|
||||
}
|
||||
// Set the gas price to the limits from the CLI and start mining
|
||||
var gasprice *big.Int
|
||||
if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) {
|
||||
gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||
if ctx.IsSet(utils.LegacyMinerGasPriceFlag.Name) && !ctx.IsSet(utils.MinerGasPriceFlag.Name) {
|
||||
gasprice = utils.GlobalBig(ctx, utils.LegacyMinerGasPriceFlag.Name)
|
||||
log.Warn("The flag --gasprice is deprecated and will be removed in the future, please use --miner.gasprice")
|
||||
}
|
||||
gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||
ethereum.TxPool().SetGasPrice(gasprice)
|
||||
|
||||
var threads int
|
||||
if ctx.GlobalIsSet(utils.LegacyMinerThreadsFlag.Name) {
|
||||
threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
||||
if ctx.GlobalIsSet(utils.LegacyMinerThreadsFlag.Name) && !ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
|
||||
threads = ctx.GlobalInt(utils.LegacyMinerThreadsFlag.Name)
|
||||
log.Warn("The flag --minerthreads is deprecated and will be removed in the future, please use --miner.threads")
|
||||
}
|
||||
threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
||||
|
||||
if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
|
||||
threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
||||
}
|
||||
if err := ethereum.StartMining(threads); err != nil {
|
||||
utils.Fatalf("Failed to start mining: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
},
|
||||
{
|
||||
Name: "ALIASED (deprecated)",
|
||||
Flags: []cli.Flag{
|
||||
Flags: append([]cli.Flag{
|
||||
utils.LegacyRPCEnabledFlag,
|
||||
utils.LegacyRPCListenAddrFlag,
|
||||
utils.LegacyRPCPortFlag,
|
||||
|
|
@ -257,12 +257,7 @@ var AppHelpFlagGroups = []flagGroup{
|
|||
utils.LegacyWSApiFlag,
|
||||
utils.LegacyGpoBlocksFlag,
|
||||
utils.LegacyGpoPercentileFlag,
|
||||
utils.LegacyPprofAddrFlag,
|
||||
utils.LegacyPprofPortFlag,
|
||||
utils.LegacyMemprofilerateFlag,
|
||||
utils.LegacyBlockprofilerateFlag,
|
||||
utils.LegacyCpuprofileFlag,
|
||||
},
|
||||
}, debug.DeprecatedFlags...),
|
||||
},
|
||||
{
|
||||
Name: "MISC",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"gopkg.in/urfave/cli.v1"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -139,29 +138,6 @@ var (
|
|||
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)",
|
||||
Value: eth.DefaultConfig.GPO.Percentile,
|
||||
}
|
||||
LegacyPprofPortFlag = cli.IntFlag{
|
||||
Name: "pprofport",
|
||||
Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)",
|
||||
Value: 6060,
|
||||
}
|
||||
LegacyPprofAddrFlag = cli.StringFlag{
|
||||
Name: "pprofaddr",
|
||||
Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)",
|
||||
Value: "127.0.0.1",
|
||||
}
|
||||
LegacyMemprofilerateFlag = cli.IntFlag{
|
||||
Name: "memprofilerate",
|
||||
Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)",
|
||||
Value: runtime.MemProfileRate,
|
||||
}
|
||||
LegacyBlockprofilerateFlag = cli.IntFlag{
|
||||
Name: "blockprofilerate",
|
||||
Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)",
|
||||
}
|
||||
LegacyCpuprofileFlag = cli.StringFlag{
|
||||
Name: "cpuprofile",
|
||||
Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)",
|
||||
}
|
||||
)
|
||||
|
||||
func showDeprecated(c *cli.Context) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package debug
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
"io"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
|
|
@ -87,6 +86,29 @@ var (
|
|||
Name: "trace",
|
||||
Usage: "Write execution trace to the given file",
|
||||
}
|
||||
legacyPprofPortFlag = cli.IntFlag{
|
||||
Name: "pprofport",
|
||||
Usage: "pprof HTTP server listening port (deprecated, use --pprof.port)",
|
||||
Value: 6060,
|
||||
}
|
||||
legacyPprofAddrFlag = cli.StringFlag{
|
||||
Name: "pprofaddr",
|
||||
Usage: "pprof HTTP server listening interface (deprecated, use --pprof.addr)",
|
||||
Value: "127.0.0.1",
|
||||
}
|
||||
legacyMemprofilerateFlag = cli.IntFlag{
|
||||
Name: "memprofilerate",
|
||||
Usage: "Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate)",
|
||||
Value: runtime.MemProfileRate,
|
||||
}
|
||||
legacyBlockprofilerateFlag = cli.IntFlag{
|
||||
Name: "blockprofilerate",
|
||||
Usage: "Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate)",
|
||||
}
|
||||
legacyCpuprofileFlag = cli.StringFlag{
|
||||
Name: "cpuprofile",
|
||||
Usage: "Write CPU profile to the given file (deprecated, use --pprof.cpuprofile)",
|
||||
}
|
||||
)
|
||||
|
||||
// Flags holds all command-line flags required for debugging.
|
||||
|
|
@ -96,6 +118,11 @@ var Flags = []cli.Flag{
|
|||
blockprofilerateFlag, cpuprofileFlag, traceFlag,
|
||||
}
|
||||
|
||||
var DeprecatedFlags = []cli.Flag{
|
||||
legacyPprofPortFlag, legacyPprofAddrFlag, legacyMemprofilerateFlag,
|
||||
legacyBlockprofilerateFlag, legacyCpuprofileFlag,
|
||||
}
|
||||
|
||||
var (
|
||||
ostream log.Handler
|
||||
glogger *log.GlogHandler
|
||||
|
|
@ -122,14 +149,14 @@ func Setup(ctx *cli.Context) error {
|
|||
log.Root().SetHandler(glogger)
|
||||
|
||||
// profiling, tracing
|
||||
if ctx.GlobalIsSet(utils.LegacyMemprofilerateFlag.Name) {
|
||||
runtime.MemProfileRate = ctx.GlobalInt(utils.LegacyMemprofilerateFlag.Name)
|
||||
if ctx.GlobalIsSet(legacyMemprofilerateFlag.Name) {
|
||||
runtime.MemProfileRate = ctx.GlobalInt(legacyMemprofilerateFlag.Name)
|
||||
log.Warn("The flag --memprofilerate is deprecated and will be removed in the future, please use --pprof.memprofilerate")
|
||||
}
|
||||
runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
|
||||
|
||||
if ctx.GlobalIsSet(utils.LegacyBlockprofilerateFlag.Name) {
|
||||
Handler.SetBlockProfileRate(ctx.GlobalInt(utils.LegacyBlockprofilerateFlag.Name))
|
||||
if ctx.GlobalIsSet(legacyBlockprofilerateFlag.Name) {
|
||||
Handler.SetBlockProfileRate(ctx.GlobalInt(legacyBlockprofilerateFlag.Name))
|
||||
log.Warn("The flag --blockprofilerate is deprecated and will be removed in the future, please use --pprof.blockprofilerate")
|
||||
}
|
||||
Handler.SetBlockProfileRate(ctx.GlobalInt(blockprofilerateFlag.Name))
|
||||
|
|
@ -145,7 +172,7 @@ func Setup(ctx *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if cpuFile := ctx.GlobalString(utils.LegacyCpuprofileFlag.Name); cpuFile != "" {
|
||||
if cpuFile := ctx.GlobalString(legacyCpuprofileFlag.Name); cpuFile != "" {
|
||||
log.Warn("The flag --cpuprofile is deprecated and will be removed in the future, please use --pprof.cpuprofile")
|
||||
if err := Handler.StartCPUProfile(cpuFile); err != nil {
|
||||
return err
|
||||
|
|
@ -155,14 +182,14 @@ func Setup(ctx *cli.Context) error {
|
|||
// pprof server
|
||||
if ctx.GlobalBool(pprofFlag.Name) {
|
||||
listenHost := ctx.GlobalString(pprofAddrFlag.Name)
|
||||
if ctx.GlobalIsSet(utils.LegacyPprofAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) {
|
||||
listenHost = ctx.GlobalString(utils.LegacyPprofAddrFlag.Name)
|
||||
if ctx.GlobalIsSet(legacyPprofAddrFlag.Name) && !ctx.GlobalIsSet(pprofAddrFlag.Name) {
|
||||
listenHost = ctx.GlobalString(legacyPprofAddrFlag.Name)
|
||||
log.Warn("The flag --pprofaddr is deprecated and will be removed in the future, please use --pprof.addr")
|
||||
}
|
||||
|
||||
port := ctx.GlobalInt(pprofPortFlag.Name)
|
||||
if ctx.GlobalIsSet(utils.LegacyPprofPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) {
|
||||
port = ctx.GlobalInt(utils.LegacyPprofPortFlag.Name)
|
||||
if ctx.GlobalIsSet(legacyPprofPortFlag.Name) && !ctx.GlobalIsSet(pprofPortFlag.Name) {
|
||||
port = ctx.GlobalInt(legacyPprofPortFlag.Name)
|
||||
log.Warn("The flag --pprofport is deprecated and will be removed in the future, please use --pprof.port")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue