Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/ethereal/main.go

63 lines
1.4 KiB

package main
import (
10 years ago
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/go-ethereum/ethereal/ui"
"github.com/ethereum/go-ethereum/utils"
"github.com/go-qml/qml"
"os"
10 years ago
"runtime"
)
func main() {
10 years ago
// Leave QT on top at ALL times. Qt Needs to be initialized from the main thread
qml.Init(nil)
runtime.GOMAXPROCS(runtime.NumCPU())
var interrupted = false
utils.RegisterInterrupt(func(os.Signal) {
interrupted = true
})
utils.HandleInterrupt()
// precedence: code-internal flag default < config file < environment variables < command line
Init() // parsing command line
utils.InitConfig(ConfigFile, Datadir, Identifier, "ETH")
utils.InitDataDir(Datadir)
utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile)
ethereum := utils.NewEthereum(UseUPnP, OutboundPort, MaxPeer)
// create, import, export keys
10 years ago
utils.KeyTasks(GenAddr, ImportKey, ExportKey, NonInteractive)
10 years ago
if ShowGenesis {
utils.ShowGenesis(ethereum)
}
if StartRpc {
utils.StartRpc(ethereum, RpcPort)
}
gui := ethui.New(ethereum, LogLevel)
utils.RegisterInterrupt(func(os.Signal) {
10 years ago
gui.Stop()
})
utils.StartEthereum(ethereum, UseSeed)
10 years ago
// gui blocks the main thread
gui.Start(AssetPath)
// we need to run the interrupt callbacks in case gui is closed
// this skips if we got here by actual interrupt stopping the GUI
if !interrupted {
utils.RunInterruptCallbacks(os.Interrupt)
10 years ago
}
// this blocks the thread
ethereum.WaitForShutdown()
ethlog.Flush()
}