-
Notifications
You must be signed in to change notification settings - Fork 17
/
cmds.go
78 lines (73 loc) · 1.57 KB
/
cmds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 2017-2018 The qitmeer developers
package cmd
import (
"github.com/Qitmeer/qng/config"
"github.com/Qitmeer/qng/meerevm/amana"
"github.com/Qitmeer/qng/meerevm/eth"
"github.com/Qitmeer/qng/meerevm/meer"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/urfave/cli/v2"
)
var (
Commands = []*cli.Command{
removedbCommand,
// See accountcmd.go:
accountCommand,
walletCommand,
// See consolecmd.go:
attachCommand,
// see dbcmd.go
dbCommand,
// See cmd/utils/flags_legacy.go
utils.ShowDeprecated,
// See snapshot.go
snapshotCommand,
}
)
func makeConfigNode(ctx *cli.Context, cfg *config.Config) (*node.Node, *eth.Config) {
eth.InitLog(cfg.DebugLevel, cfg.DebugPrintOrigins)
//
var ecfg *eth.Config
var args []string
var err error
if cfg.Amana {
ecfg, args, err = amana.MakeParams(cfg)
if err != nil {
log.Error(err.Error())
return nil, nil
}
} else {
ecfg, args, err = meer.MakeParams(cfg)
if err != nil {
log.Error(err.Error())
return nil, nil
}
}
var n *node.Node
n, _, err = eth.MakeNakedNode(ecfg, args)
if err != nil {
log.Error(err.Error())
return nil, nil
}
return n, ecfg
}
func makeConfig(cfg *config.Config) (*eth.Config, error) {
var ecfg *eth.Config
var err error
if cfg.Amana {
ecfg, err = amana.MakeConfig(cfg.DataDir)
if err != nil {
log.Error(err.Error())
return nil, nil
}
} else {
ecfg, err = meer.MakeConfig(cfg)
if err != nil {
log.Error(err.Error())
return nil, nil
}
}
return ecfg, nil
}