diff options
author | Felix Lange <fjl@twurst.com> | 2016-08-18 19:28:17 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-09-16 21:24:31 +0800 |
commit | eeb322ae649c4a1a32430cdddfffed70f509181e (patch) | |
tree | 35622201208afb98665743d9bcf88883058e772a /cmd/geth/main.go | |
parent | 52ede09b172094f8fd85f8b10e7d0578059353fb (diff) | |
download | dexon-eeb322ae649c4a1a32430cdddfffed70f509181e.tar.gz dexon-eeb322ae649c4a1a32430cdddfffed70f509181e.tar.zst dexon-eeb322ae649c4a1a32430cdddfffed70f509181e.zip |
node: ensure datadir can be co-inhabited by different instances
This change ensures that nodes started with different Name but same
DataDir values don't use the same nodekey and IPC socket.
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r-- | cmd/geth/main.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index a7b332d0f..65311ca41 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -36,7 +36,6 @@ import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/internal/debug" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" @@ -46,7 +45,7 @@ import ( ) const ( - clientIdentifier = "Geth" // Client identifier to advertise over the network + clientIdentifier = "geth" // Client identifier to advertise over the network ) var ( @@ -245,17 +244,15 @@ func initGenesis(ctx *cli.Context) error { state.StartingNonce = 1048576 // (2**20) } - chainDb, err := ethdb.NewLDBDatabase(filepath.Join(utils.MustMakeDataDir(ctx), "chaindata"), 0, 0) - if err != nil { - utils.Fatalf("could not open database: %v", err) - } + stack := makeFullNode(ctx) + chaindb := utils.MakeChainDatabase(ctx, stack) genesisFile, err := os.Open(genesisPath) if err != nil { utils.Fatalf("failed to read genesis file: %v", err) } - block, err := core.WriteGenesisBlock(chainDb, genesisFile) + block, err := core.WriteGenesisBlock(chaindb, genesisFile) if err != nil { utils.Fatalf("failed to write genesis block: %v", err) } @@ -296,9 +293,6 @@ func makeFullNode(ctx *cli.Context) *node.Node { // it unlocks any requested accounts, and starts the RPC/IPC interfaces and the // miner. func startNode(ctx *cli.Context, stack *node.Node) { - // Report geth version - glog.V(logger.Info).Infof("instance: Geth/%s/%s/%s\n", utils.Version, runtime.Version(), runtime.GOOS) - // Start up the node itself utils.StartNode(stack) @@ -379,7 +373,7 @@ func gpubench(ctx *cli.Context) error { } func version(c *cli.Context) error { - fmt.Println(clientIdentifier) + fmt.Println(strings.Title(clientIdentifier)) fmt.Println("Version:", utils.Version) if gitCommit != "" { fmt.Println("Git Commit:", gitCommit) |