diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-14 01:30:45 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-14 01:41:09 +0800 |
commit | 58d9d98dafc9013a4aa6f7f2c8c8e3d9ad76ce7c (patch) | |
tree | 6b2127d8490b42baaf1ad6ca5d06114014768bf3 /cmd | |
parent | a80be98f31976207667a484f1f7b0eac79794ef9 (diff) | |
download | dexon-58d9d98dafc9013a4aa6f7f2c8c8e3d9ad76ce7c.tar.gz dexon-58d9d98dafc9013a4aa6f7f2c8c8e3d9ad76ce7c.tar.zst dexon-58d9d98dafc9013a4aa6f7f2c8c8e3d9ad76ce7c.zip |
cmd/utils: GetEthereum -> MakeEthConfig
This allows changing the config before starting Ethereum
with it.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ethereum/main.go | 18 | ||||
-rw-r--r-- | cmd/mist/main.go | 4 | ||||
-rw-r--r-- | cmd/utils/flags.go | 6 |
3 files changed, 16 insertions, 12 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 8b01457e6..d31053fb1 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -156,24 +156,26 @@ func main() { func run(ctx *cli.Context) { fmt.Printf("Welcome to the FRONTIER\n") utils.HandleInterrupt() - eth, err := utils.GetEthereum(ClientIdentifier, Version, ctx) + cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) + ethereum, err := eth.New(cfg) if err != nil { utils.Fatalf("%v", err) } - startEth(ctx, eth) + startEth(ctx, ethereum) // this blocks the thread - eth.WaitForShutdown() + ethereum.WaitForShutdown() } func runjs(ctx *cli.Context) { - eth, err := utils.GetEthereum(ClientIdentifier, Version, ctx) + cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) + ethereum, err := eth.New(cfg) if err != nil { utils.Fatalf("%v", err) } - startEth(ctx, eth) - repl := newJSRE(eth) + startEth(ctx, ethereum) + repl := newJSRE(ethereum) if len(ctx.Args()) == 0 { repl.interactive() } else { @@ -181,8 +183,8 @@ func runjs(ctx *cli.Context) { repl.exec(file) } } - eth.Stop() - eth.WaitForShutdown() + ethereum.Stop() + ethereum.WaitForShutdown() } func startEth(ctx *cli.Context, eth *eth.Ethereum) { diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 9a773e33a..4116783c9 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -28,6 +28,7 @@ import ( "github.com/codegangsta/cli" "github.com/ethereum/go-ethereum/cmd/utils" + "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/ui/qt/webengine" @@ -95,7 +96,8 @@ func run(ctx *cli.Context) { tstart := time.Now() // TODO: show qml popup instead of exiting if initialization fails. - ethereum, err := utils.GetEthereum(ClientIdentifier, Version, ctx) + cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) + ethereum, err := eth.New(cfg) if err != nil { utils.Fatalf("%v", err) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5c188a41e..2db071148 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -192,8 +192,8 @@ func GetNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) { return key } -func GetEthereum(clientID, version string, ctx *cli.Context) (*eth.Ethereum, error) { - return eth.New(ð.Config{ +func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { + return ð.Config{ Name: p2p.MakeName(clientID, version), DataDir: ctx.GlobalString(DataDirFlag.Name), LogFile: ctx.GlobalString(LogFileFlag.Name), @@ -209,7 +209,7 @@ func GetEthereum(clientID, version string, ctx *cli.Context) (*eth.Ethereum, err Shh: true, Dial: true, BootNodes: ctx.GlobalString(BootnodesFlag.Name), - }) + } } func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database, ethutil.Database) { |