diff options
author | Wei-Ning Huang <w@cobinhood.com> | 2018-09-25 18:55:00 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-07 18:45:19 +0800 |
commit | bc5a3c35468c272869966176f98f3d5522f4b607 (patch) | |
tree | 563449e510ff69344e162c51ae6a8efde61e57a7 /cmd/utils | |
parent | ee0c68dff2488af88b2c128bf5ac56410e6d740f (diff) | |
download | dexon-bc5a3c35468c272869966176f98f3d5522f4b607.tar.gz dexon-bc5a3c35468c272869966176f98f3d5522f4b607.tar.zst dexon-bc5a3c35468c272869966176f98f3d5522f4b607.zip |
Use dex.Config instead of eth.Config
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/flags.go | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index d5f2f248c..2e699f4db 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -21,7 +21,6 @@ import ( "crypto/ecdsa" "fmt" "io/ioutil" - "math/big" "os" "path/filepath" "strconv" @@ -1171,18 +1170,15 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { } } -// SetEthConfig applies eth-related command line flags to the config. -func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { +// SetDexConfig applies eth-related command line flags to the config. +func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) { // Avoid conflicting network flags checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, GoerliFlag) checkExclusive(ctx, LightServFlag, SyncModeFlag, "light") ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) - setEtherbase(ctx, ks, cfg) setGPO(ctx, &cfg.GPO) setTxPool(ctx, &cfg.TxPool) - setEthash(ctx, cfg) - setWhitelist(ctx, cfg) if ctx.GlobalIsSet(SyncModeFlag.Name) { cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) @@ -1212,39 +1208,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) { cfg.TrieDirtyCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100 } - if ctx.GlobalIsSet(MinerNotifyFlag.Name) { - cfg.MinerNotify = strings.Split(ctx.GlobalString(MinerNotifyFlag.Name), ",") - } if ctx.GlobalIsSet(DocRootFlag.Name) { cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name) } - if ctx.GlobalIsSet(MinerLegacyExtraDataFlag.Name) { - cfg.MinerExtraData = []byte(ctx.GlobalString(MinerLegacyExtraDataFlag.Name)) - } - if ctx.GlobalIsSet(MinerExtraDataFlag.Name) { - cfg.MinerExtraData = []byte(ctx.GlobalString(MinerExtraDataFlag.Name)) - } - if ctx.GlobalIsSet(MinerLegacyGasTargetFlag.Name) { - cfg.MinerGasFloor = ctx.GlobalUint64(MinerLegacyGasTargetFlag.Name) - } - if ctx.GlobalIsSet(MinerGasTargetFlag.Name) { - cfg.MinerGasFloor = ctx.GlobalUint64(MinerGasTargetFlag.Name) - } - if ctx.GlobalIsSet(MinerGasLimitFlag.Name) { - cfg.MinerGasCeil = ctx.GlobalUint64(MinerGasLimitFlag.Name) - } - if ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { - cfg.MinerGasPrice = GlobalBig(ctx, MinerLegacyGasPriceFlag.Name) - } - if ctx.GlobalIsSet(MinerGasPriceFlag.Name) { - cfg.MinerGasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name) - } - if ctx.GlobalIsSet(MinerRecommitIntervalFlag.Name) { - cfg.MinerRecommit = ctx.Duration(MinerRecommitIntervalFlag.Name) - } - if ctx.GlobalIsSet(MinerNoVerfiyFlag.Name) { - cfg.MinerNoverify = ctx.Bool(MinerNoVerfiyFlag.Name) - } if ctx.GlobalIsSet(VMEnableDebugFlag.Name) { // TODO(fjl): force-enable this in --dev mode cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name) @@ -1298,9 +1264,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { log.Info("Using developer account", "address", developer.Address) cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address) - if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) { - cfg.MinerGasPrice = big.NewInt(1) - } } // TODO(fjl): move trie cache generations into config if gen := ctx.GlobalInt(TrieCacheGenFlag.Name); gen > 0 { @@ -1315,13 +1278,13 @@ func SetDashboardConfig(ctx *cli.Context, cfg *dashboard.Config) { cfg.Refresh = ctx.GlobalDuration(DashboardRefreshFlag.Name) } -// RegisterEthService adds an Ethereum client to the stack. -func RegisterEthService(stack *node.Node, cfg *eth.Config) { +// RegisterDexService adds an Dexon client to the stack. +func RegisterDexService(stack *node.Node, cfg *dex.Config) { var err error if cfg.SyncMode == downloader.LightSync { - err = stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { - return les.New(ctx, cfg) - }) + //err = stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + // return les.New(ctx, cfg) + //}) } else { err = stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { fullNode, err := dex.New(ctx, cfg) |