diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-04 21:20:16 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-04 21:20:16 +0800 |
commit | 09841b1c9b2553a4572590128580df37c8fa83ad (patch) | |
tree | 42a846801bde7d8f7edc5ec07ccbba7806261128 /cmd/mist | |
parent | bd0c267cbe9db805b5a272d29ef8860c62ddafe5 (diff) | |
download | dexon-09841b1c9b2553a4572590128580df37c8fa83ad.tar.gz dexon-09841b1c9b2553a4572590128580df37c8fa83ad.tar.zst dexon-09841b1c9b2553a4572590128580df37c8fa83ad.zip |
Cleaned up some of that util
Diffstat (limited to 'cmd/mist')
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 2 | ||||
-rw-r--r-- | cmd/mist/assets/qml/views/wallet.qml | 2 | ||||
-rw-r--r-- | cmd/mist/bindings.go | 2 | ||||
-rw-r--r-- | cmd/mist/gui.go | 5 | ||||
-rw-r--r-- | cmd/mist/main.go | 40 |
5 files changed, 25 insertions, 26 deletions
diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index 06a7bc2a8..5df4c8aad 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -866,12 +866,14 @@ ApplicationWindow { model: ListModel { id: pastPeers } Component.onCompleted: { + /* var ips = eth.pastPeers() for(var i = 0; i < ips.length; i++) { pastPeers.append({text: ips.get(i)}) } pastPeers.insert(0, {text: "poc-7.ethdev.com:30303"}) + */ } } diff --git a/cmd/mist/assets/qml/views/wallet.qml b/cmd/mist/assets/qml/views/wallet.qml index 9727ef35c..b81273a17 100644 --- a/cmd/mist/assets/qml/views/wallet.qml +++ b/cmd/mist/assets/qml/views/wallet.qml @@ -20,7 +20,7 @@ Rectangle { } function setBalance() { - balance.text = "<b>Balance</b>: " + eth.numberToHuman(eth.balanceAt(eth.key().address)) + //balance.text = "<b>Balance</b>: " + eth.numberToHuman(eth.balanceAt(eth.key().address)) if(menuItem) menuItem.secondaryTitle = eth.numberToHuman(eth.balanceAt(eth.key().address)) } diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 6d2342c87..66d8d1491 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -72,7 +72,7 @@ func (gui *Gui) GetCustomIdentifier() string { // functions that allow Gui to implement interface guilogger.LogSystem func (gui *Gui) SetLogLevel(level logger.LogLevel) { gui.logLevel = level - gui.stdLog.SetLogLevel(level) + gui.eth.Logger().SetLogLevel(level) gui.config.Save("loglevel", level) } diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 98ca70b16..8e533d977 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -72,8 +72,7 @@ type Gui struct { plugins map[string]plugin - miner *miner.Miner - stdLog logger.LogSystem + miner *miner.Miner } // Create GUI, but doesn't start it @@ -113,7 +112,7 @@ func (gui *Gui) Start(assetPath string) { // Expose the eth library and the ui library to QML context.SetVar("gui", gui) context.SetVar("eth", gui.uiLib) - context.SetVar("shh", gui.whisper) + //context.SetVar("shh", gui.whisper) // Load the main QML interface data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) diff --git a/cmd/mist/main.go b/cmd/mist/main.go index 6f578ff48..cae666d45 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/p2p" "gopkg.in/qml.v1" ) @@ -35,6 +36,7 @@ const ( ) var ethereum *eth.Ethereum +var mainlogger = logger.NewLogger("MAIN") func run() error { // precedence: code-internal flag default < config file < environment variables < command line @@ -43,27 +45,24 @@ func run() error { tstart := time.Now() config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") - utils.InitDataDir(Datadir) - - stdLog := utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile) - - db := utils.NewDatabase() - err := utils.DBSanityCheck(db) + ethereum, err := eth.New(ð.Config{ + Name: ClientIdentifier, + Version: Version, + KeyStore: KeyStore, + DataDir: Datadir, + LogFile: LogFile, + LogLevel: LogLevel, + Identifier: Identifier, + MaxPeers: MaxPeer, + Port: OutboundPort, + NATType: PMPGateway, + PMPGateway: PMPGateway, + KeyRing: KeyRing, + }) if err != nil { - ErrorWindow(err) - - os.Exit(1) - } - keyManager := utils.NewKeyManager(KeyStore, Datadir, db) - - // create, import, export keys - utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) - clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier, string(keyManager.PublicKey())) - ethereum := utils.NewEthereum(db, clientIdentity, keyManager, utils.NatType(NatType, PMPGateway), OutboundPort, MaxPeer) - - if ShowGenesis { - utils.ShowGenesis(ethereum) + mainlogger.Fatalln(err) } + utils.KeyTasks(ethereum.KeyManager(), KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive) if StartRpc { utils.StartRpc(ethereum, RpcPort) @@ -73,8 +72,7 @@ func run() error { utils.StartWebSockets(ethereum) } - gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel) - gui.stdLog = stdLog + gui := NewWindow(ethereum, config, ethereum.ClientIdentity().(*p2p.SimpleClientIdentity), KeyRing, LogLevel) utils.RegisterInterrupt(func(os.Signal) { gui.Stop() |