|
|
|
@ -242,6 +242,26 @@ func init() { |
|
|
|
|
if err := debug.Setup(ctx, logdir); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
app.After = func(ctx *cli.Context) error { |
|
|
|
|
debug.Exit() |
|
|
|
|
console.Stdin.Close() // Resets terminal mode.
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
if err := app.Run(os.Args); err != nil { |
|
|
|
|
fmt.Fprintln(os.Stderr, err) |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// prepare manipulates memory cache allowance and setups metric system.
|
|
|
|
|
// This function should be called before launching devp2p stack.
|
|
|
|
|
func prepare(ctx *cli.Context) { |
|
|
|
|
// If we're a full node on mainnet without --cache specified, bump default cache allowance
|
|
|
|
|
if ctx.GlobalString(utils.SyncModeFlag.Name) != "light" && !ctx.GlobalIsSet(utils.CacheFlag.Name) && !ctx.GlobalIsSet(utils.NetworkIdFlag.Name) { |
|
|
|
|
// Make sure we're not on any supported preconfigured testnet either
|
|
|
|
@ -281,22 +301,6 @@ func init() { |
|
|
|
|
|
|
|
|
|
// Start system runtime metrics collection
|
|
|
|
|
go metrics.CollectProcessMetrics(3 * time.Second) |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
app.After = func(ctx *cli.Context) error { |
|
|
|
|
debug.Exit() |
|
|
|
|
console.Stdin.Close() // Resets terminal mode.
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
if err := app.Run(os.Args); err != nil { |
|
|
|
|
fmt.Fprintln(os.Stderr, err) |
|
|
|
|
os.Exit(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// geth is the main entry point into the system if no special subcommand is ran.
|
|
|
|
@ -306,6 +310,7 @@ func geth(ctx *cli.Context) error { |
|
|
|
|
if args := ctx.Args(); len(args) > 0 { |
|
|
|
|
return fmt.Errorf("invalid command: %q", args[0]) |
|
|
|
|
} |
|
|
|
|
prepare(ctx) |
|
|
|
|
node := makeFullNode(ctx) |
|
|
|
|
defer node.Close() |
|
|
|
|
startNode(ctx, node) |
|
|
|
|