diff options
Diffstat (limited to 'cmd/ethereum/main.go')
-rw-r--r-- | cmd/ethereum/main.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go index 43551fb3a..7efee31e7 100644 --- a/cmd/ethereum/main.go +++ b/cmd/ethereum/main.go @@ -21,6 +21,7 @@ import ( "fmt" "os" "runtime" + "time" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/core/types" @@ -30,7 +31,7 @@ import ( const ( ClientIdentifier = "Ethereum(G)" - Version = "0.7.9" + Version = "0.7.11" ) var clilogger = logger.NewLogger("CLI") @@ -38,6 +39,10 @@ var clilogger = logger.NewLogger("CLI") func main() { runtime.GOMAXPROCS(runtime.NumCPU()) + defer func() { + logger.Flush() + }() + utils.HandleInterrupt() // precedence: code-internal flag default < config file < environment variables < command line @@ -69,15 +74,15 @@ func main() { // create, import, export keys utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) - clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier) + clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier, string(keyManager.PublicKey())) - ethereum := utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer) + ethereum := utils.NewEthereum(db, clientIdentity, keyManager, utils.NatType(NatType, PMPGateway), OutboundPort, MaxPeer) if Dump { var block *types.Block if len(DumpHash) == 0 && DumpNumber == -1 { - block = ethereum.ChainManager().CurrentBlock + block = ethereum.ChainManager().CurrentBlock() } else if len(DumpHash) > 0 { block = ethereum.ChainManager().GetBlock(ethutil.Hex2Bytes(DumpHash)) } else { @@ -93,9 +98,6 @@ func main() { os.Exit(1) } - // block.GetRoot() does not exist - //fmt.Printf("RLP: %x\nstate: %x\nhash: %x\n", ethutil.Rlp(block), block.GetRoot(), block.Hash()) - // Leave the Println. This needs clean output for piping fmt.Printf("%s\n", block.State().Dump()) @@ -112,6 +114,16 @@ func main() { utils.StartMining(ethereum) } + if len(ImportChain) > 0 { + start := time.Now() + err := utils.ImportChain(ethereum, ImportChain) + if err != nil { + clilogger.Infoln(err) + } + clilogger.Infoln("import done in", time.Since(start)) + return + } + // better reworked as cases if StartJsConsole { InitJsConsole(ethereum) @@ -131,5 +143,4 @@ func main() { // this blocks the thread ethereum.WaitForShutdown() - logger.Flush() } |