From 184055b3e2995894ccaba364484223e488730627 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 23 Oct 2014 15:48:53 +0200 Subject: cmd/*: add license headers --- cmd/mist/gui.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 2a9ab3918..45a99659b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -1,3 +1,20 @@ +// Copyright (c) 2013-2014, Jeffrey Wilcke. All rights reserved. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// MA 02110-1301 USA + package main import "C" -- cgit v1.2.3 From 6b3f5fb82b0304f477a1c36b68b0d07232405aff Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 29 Oct 2014 03:50:20 +0100 Subject: cmd/mist, ethchain, ethminer: split TxEvent (#165) --- cmd/mist/gui.go | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 45a99659b..e6da33475 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -408,7 +408,8 @@ func (gui *Gui) update() { eth.ChainSyncEvent{}, eth.PeerListEvent{}, ethchain.NewBlockEvent{}, - ethchain.TxEvent{}, + ethchain.TxPreEvent{}, + ethchain.TxPostEvent{}, ethminer.Event{}, ) @@ -430,40 +431,38 @@ func (gui *Gui) update() { gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case ethchain.TxEvent: + case ethchain.TxPreEvent: tx := ev.Tx - if ev.Type == ethchain.TxPre { - object := state.GetAccount(gui.address()) + object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - unconfirmedFunds.Add(unconfirmedFunds, tx.Value) - } - - gui.setWalletValue(object.Balance(), unconfirmedFunds) - - gui.insertTransaction("pre", tx) + if bytes.Compare(tx.Sender(), gui.address()) == 0 { + unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) + } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { + unconfirmedFunds.Add(unconfirmedFunds, tx.Value) + } - } else if ev.Type == ethchain.TxPost { - object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - object.SubAmount(tx.Value) + gui.setWalletValue(object.Balance(), unconfirmedFunds) + gui.insertTransaction("pre", tx) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - object.AddAmount(tx.Value) + case ethchain.TxPostEvent: + tx := ev.Tx + object := state.GetAccount(gui.address()) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } + if bytes.Compare(tx.Sender(), gui.address()) == 0 { + object.SubAmount(tx.Value) - gui.setWalletValue(object.Balance(), nil) + //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") + gui.txDb.Put(tx.Hash(), tx.RlpEncode()) + } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { + object.AddAmount(tx.Value) - state.UpdateStateObject(object) + //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") + gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } + gui.setWalletValue(object.Balance(), nil) + state.UpdateStateObject(object) + // case object: // gui.loadAddressBook() -- cgit v1.2.3 From 3ee0461cb5b6e4a5e2d287180afbdb681805a662 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 10:59:17 +0100 Subject: Moved ethchain to chain --- cmd/mist/gui.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e6da33475..c917ad06e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -31,7 +31,7 @@ import ( "time" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/ethchain" + "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethminer" @@ -286,7 +286,7 @@ func (gui *Gui) loadAddressBook() { } } -func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { +func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { pipe := ethpipe.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -336,7 +336,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { func (gui *Gui) readPreviousTransactions() { it := gui.txDb.Db().NewIterator(nil, nil) for it.Next() { - tx := ethchain.NewTransactionFromBytes(it.Value()) + tx := chain.NewTransactionFromBytes(it.Value()) gui.insertTransaction("post", tx) @@ -344,7 +344,7 @@ func (gui *Gui) readPreviousTransactions() { it.Release() } -func (gui *Gui) processBlock(block *ethchain.Block, initial bool) { +func (gui *Gui) processBlock(block *chain.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") b := ethpipe.NewJSBlock(block) b.Name = name @@ -407,9 +407,9 @@ func (gui *Gui) update() { events := gui.eth.EventMux().Subscribe( eth.ChainSyncEvent{}, eth.PeerListEvent{}, - ethchain.NewBlockEvent{}, - ethchain.TxPreEvent{}, - ethchain.TxPostEvent{}, + chain.NewBlockEvent{}, + chain.TxPreEvent{}, + chain.TxPostEvent{}, ethminer.Event{}, ) @@ -425,13 +425,13 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { - case ethchain.NewBlockEvent: + case chain.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case ethchain.TxPreEvent: + case chain.TxPreEvent: tx := ev.Tx object := state.GetAccount(gui.address()) @@ -444,7 +444,7 @@ func (gui *Gui) update() { gui.setWalletValue(object.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) - case ethchain.TxPostEvent: + case chain.TxPostEvent: tx := ev.Tx object := state.GetAccount(gui.address()) -- cgit v1.2.3 From b1c247231b11f313ca0eedff75ea563926d23f68 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 12:56:05 +0100 Subject: ethlog => logger --- cmd/mist/gui.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c917ad06e..4ae92a340 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -33,11 +33,11 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethwire" + "github.com/ethereum/go-ethereum/logger" "gopkg.in/qml.v1" ) @@ -64,7 +64,7 @@ func LoadExtension(path string) (uintptr, error) { } */ -var logger = ethlog.NewLogger("GUI") +var guilogger = logger.NewLogger("GUI") type Gui struct { // The main application window @@ -81,7 +81,7 @@ type Gui struct { txDb *ethdb.LDBDatabase - logLevel ethlog.LogLevel + logLevel logger.LogLevel open bool pipe *ethpipe.JSPipe @@ -93,7 +93,7 @@ type Gui struct { plugins map[string]plugin miner *ethminer.Miner - stdLog ethlog.LogSystem + stdLog logger.LogSystem } // Create GUI, but doesn't start it @@ -104,7 +104,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden } pipe := ethpipe.NewJSPipe(ethereum) - gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} + gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: logger.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) @@ -155,36 +155,36 @@ func (gui *Gui) Start(assetPath string) { addlog = true } if err != nil { - logger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) + guilogger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) panic(err) } - logger.Infoln("Starting GUI") + guilogger.Infoln("Starting GUI") gui.open = true win.Show() - // only add the gui logger after window is shown otherwise slider wont be shown + // only add the gui guilogger after window is shown otherwise slider wont be shown if addlog { - ethlog.AddLogSystem(gui) + logger.AddLogSystem(gui) } win.Wait() - // need to silence gui logger after window closed otherwise logsystem hangs (but do not save loglevel) - gui.logLevel = ethlog.Silence + // need to silence gui guilogger after window closed otherwise logsystem hangs (but do not save loglevel) + gui.logLevel = logger.Silence gui.open = false } func (gui *Gui) Stop() { if gui.open { - gui.logLevel = ethlog.Silence + gui.logLevel = logger.Silence gui.open = false gui.win.Hide() } gui.uiLib.jsEngine.Stop() - logger.Infoln("Stopped") + guilogger.Infoln("Stopped") } func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) { @@ -229,17 +229,17 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window { func (gui *Gui) ImportAndSetPrivKey(secret string) bool { err := gui.eth.KeyManager().InitFromString(gui.Session, 0, secret) if err != nil { - logger.Errorln("unable to import: ", err) + guilogger.Errorln("unable to import: ", err) return false } - logger.Errorln("successfully imported: ", err) + guilogger.Errorln("successfully imported: ", err) return true } func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { err := gui.eth.KeyManager().Init(gui.Session, 0, true) if err != nil { - logger.Errorln("unable to create key: ", err) + guilogger.Errorln("unable to create key: ", err) return "", "", "", "" } return gui.eth.KeyManager().KeyPair().AsStrings() @@ -387,7 +387,7 @@ func (gui *Gui) update() { }() for _, plugin := range gui.plugins { - logger.Infoln("Loading plugin ", plugin.Name) + guilogger.Infoln("Loading plugin ", plugin.Name) gui.win.Root().Call("addPlugin", plugin.Path, "") } -- cgit v1.2.3 From 0ed1a8b50a9b9726cd57a2731d0405f6949c6188 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:30:08 +0100 Subject: ethpipe => xeth (eXtended ETHereum) --- cmd/mist/gui.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 4ae92a340..2dfdd104f 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -34,10 +34,10 @@ import ( "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethminer" - "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -84,7 +84,7 @@ type Gui struct { logLevel logger.LogLevel open bool - pipe *ethpipe.JSPipe + pipe *xeth.JSXEth Session string clientIdentity *ethwire.SimpleClientIdentity @@ -103,7 +103,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden panic(err) } - pipe := ethpipe.NewJSPipe(ethereum) + pipe := xeth.NewJSXEth(ethereum) gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: logger.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) @@ -117,11 +117,11 @@ func (gui *Gui) Start(assetPath string) { // Register ethereum functions qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ - Init: func(p *ethpipe.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, + Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, }, { - Init: func(p *ethpipe.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, + Init: func(p *xeth.JSTransaction, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, }, { - Init: func(p *ethpipe.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, + Init: func(p *xeth.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" }, }}) // Create a new QML engine gui.engine = qml.NewEngine() @@ -287,7 +287,7 @@ func (gui *Gui) loadAddressBook() { } func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { - pipe := ethpipe.New(gui.eth) + pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -299,7 +299,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { } var ( - ptx = ethpipe.NewJSTx(tx, pipe.World().State()) + ptx = xeth.NewJSTx(tx, pipe.World().State()) send = nameReg.Storage(tx.Sender()) rec = nameReg.Storage(tx.Recipient) s, r string @@ -346,7 +346,7 @@ func (gui *Gui) readPreviousTransactions() { func (gui *Gui) processBlock(block *chain.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") - b := ethpipe.NewJSBlock(block) + b := xeth.NewJSBlock(block) b.Name = name gui.getObjectByName("chainView").Call("addBlock", b, initial) @@ -451,12 +451,12 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { object.SubAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "send") + //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { object.AddAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", ethpipe.NewJSTx(tx), "recv") + //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } -- cgit v1.2.3 From 4914a78c8c650d7fc74570f25a682598aaeb6973 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:53:42 +0100 Subject: ethwire => wire --- cmd/mist/gui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 2dfdd104f..d309e0a9b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -35,8 +35,8 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethutil" - "github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/wire" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" ) @@ -87,7 +87,7 @@ type Gui struct { pipe *xeth.JSXEth Session string - clientIdentity *ethwire.SimpleClientIdentity + clientIdentity *wire.SimpleClientIdentity config *ethutil.ConfigManager plugins map[string]plugin @@ -97,7 +97,7 @@ type Gui struct { } // Create GUI, but doesn't start it -func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *ethwire.SimpleClientIdentity, session string, logLevel int) *Gui { +func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIdentity *wire.SimpleClientIdentity, session string, logLevel int) *Gui { db, err := ethdb.NewLDBDatabase("tx_database") if err != nil { panic(err) -- cgit v1.2.3 From 5af4ff985dc43b648bdc96394a3bd96d9658ae0a Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 31 Oct 2014 14:56:42 +0100 Subject: ethminer => miner --- cmd/mist/gui.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index d309e0a9b..d6f6832e2 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -33,9 +33,9 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/wire" "github.com/ethereum/go-ethereum/xeth" "gopkg.in/qml.v1" @@ -92,7 +92,7 @@ type Gui struct { plugins map[string]plugin - miner *ethminer.Miner + miner *miner.Miner stdLog logger.LogSystem } @@ -410,7 +410,7 @@ func (gui *Gui) update() { chain.NewBlockEvent{}, chain.TxPreEvent{}, chain.TxPostEvent{}, - ethminer.Event{}, + miner.Event{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -469,8 +469,8 @@ func (gui *Gui) update() { case eth.PeerListEvent: gui.setPeerInfo() - case ethminer.Event: - if ev.Type == ethminer.Started { + case miner.Event: + if ev.Type == miner.Started { gui.miner = ev.Miner } else { gui.miner = nil -- cgit v1.2.3 From bd4f51ff3c75c186dbc8a71439953c8fc05b16cd Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 3 Nov 2014 00:30:52 +0100 Subject: Use new iterator --- cmd/mist/gui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index d6f6832e2..8fa068c14 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -334,7 +334,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { } func (gui *Gui) readPreviousTransactions() { - it := gui.txDb.Db().NewIterator(nil, nil) + it := gui.txDb.NewIterator() for it.Next() { tx := chain.NewTransactionFromBytes(it.Value()) -- cgit v1.2.3 From f59a3b67f69b26f969084e0de165435e80bd8e12 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 4 Nov 2014 10:57:02 +0100 Subject: StateManager => BlockManager --- cmd/mist/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 8fa068c14..5af1b5c7b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -396,7 +396,7 @@ func (gui *Gui) update() { generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) - state := gui.eth.StateManager().TransState() + state := gui.eth.BlockManager().TransState() unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) @@ -428,7 +428,7 @@ func (gui *Gui) update() { case chain.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { - gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) + gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } case chain.TxPreEvent: -- cgit v1.2.3 From 429dd2a100f3b9e2b612b59bcb48f79a805cd6f9 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 7 Nov 2014 12:18:48 +0100 Subject: Implemented new miner w/ ui interface for merged mining. Closes #177 * Miner has been rewritten * Added new miner pane * Added option for local txs * Added option to read from MergeMining contract and list them for merged mining --- cmd/mist/gui.go | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 5af1b5c7b..295011244 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -272,8 +272,6 @@ type address struct { func (gui *Gui) loadAddressBook() { view := gui.getObjectByName("infoView") - view.Call("clearAddress") - nameReg := gui.pipe.World().Config().Get("NameReg") if nameReg != nil { nameReg.EachStorage(func(name string, value *ethutil.Value) { @@ -286,6 +284,28 @@ func (gui *Gui) loadAddressBook() { } } +func (self *Gui) loadMergedMiningOptions() { + view := self.getObjectByName("mergedMiningModel") + + nameReg := self.pipe.World().Config().Get("MergeMining") + if nameReg != nil { + i := 0 + nameReg.EachStorage(func(name string, value *ethutil.Value) { + if name[0] != 0 { + value.Decode() + + view.Call("addMergedMiningOption", struct { + Checked bool + Name, Address string + Id, ItemId int + }{false, name, ethutil.Bytes2Hex(value.Bytes()), 0, i}) + + i++ + } + }) + } +} + func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") @@ -382,6 +402,7 @@ func (gui *Gui) update() { go func() { go gui.setInitialChainManager() gui.loadAddressBook() + gui.loadMergedMiningOptions() gui.setPeerInfo() gui.readPreviousTransactions() }() @@ -410,7 +431,6 @@ func (gui *Gui) update() { chain.NewBlockEvent{}, chain.TxPreEvent{}, chain.TxPostEvent{}, - miner.Event{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -469,12 +489,14 @@ func (gui *Gui) update() { case eth.PeerListEvent: gui.setPeerInfo() - case miner.Event: - if ev.Type == miner.Started { - gui.miner = ev.Miner - } else { - gui.miner = nil - } + /* + case miner.Event: + if ev.Type == miner.Started { + gui.miner = ev.Miner + } else { + gui.miner = nil + } + */ } case <-peerUpdateTicker.C: @@ -483,10 +505,13 @@ func (gui *Gui) update() { statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() lastBlockLabel.Set("text", statusText) - if gui.miner != nil { - pow := gui.miner.GetPow() - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") - } + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") + /* + if gui.miner != nil { + pow := gui.miner.GetPow() + miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") + } + */ blockLength := gui.eth.BlockPool().BlocksProcessed chainLength := gui.eth.BlockPool().ChainLength -- cgit v1.2.3 From cbeebcd47da846e1b8990313f1ff1ffe7d0bf00f Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 10 Nov 2014 01:17:31 +0100 Subject: Fixed bloom, updated mining & block processing * Reverted back to process blocks in batches method * Bloom generation and lookup fix * Minor UI changed (mainly debug) --- cmd/mist/gui.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 295011244..7e867395e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -250,17 +250,6 @@ func (gui *Gui) setInitialChainManager() { blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash - addr := gui.address() - - // Loop through all transactions to see if we missed any while being offline - for _, tx := range blk.Transactions() { - if bytes.Compare(tx.Sender(), addr) == 0 || bytes.Compare(tx.Recipient, addr) == 0 { - if ok, _ := gui.txDb.Get(tx.Hash()); ok == nil { - gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } - - } - } gui.processBlock(blk, true) } @@ -404,7 +393,7 @@ func (gui *Gui) update() { gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() - gui.readPreviousTransactions() + //gui.readPreviousTransactions() }() for _, plugin := range gui.plugins { -- cgit v1.2.3 From 711be7009ef5b9ad77f37a4ccd0dffcc9286e1f8 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 14 Nov 2014 13:51:41 +0100 Subject: Version bump --- cmd/mist/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 7e867395e..785962ea0 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -526,7 +526,7 @@ func (gui *Gui) setStatsPane() { runtime.ReadMemStats(&memStats) statsPane := gui.getObjectByName("statsPane") - statsPane.Set("text", fmt.Sprintf(`###### Mist 0.6.8 (%s) ####### + statsPane.Set("text", fmt.Sprintf(`###### Mist %s (%s) ####### eth %d (p2p = %d) @@ -539,7 +539,7 @@ Heap Alloc: %d CGNext: %x NumGC: %d -`, runtime.Version(), +`, Version, runtime.Version(), eth.ProtocolVersion, eth.P2PVersion, runtime.NumCPU, runtime.NumGoroutine(), runtime.NumCgoCall(), memStats.Alloc, memStats.HeapAlloc, -- cgit v1.2.3 From 33afb10b0da43d55b1d6e1fe6b1b97c6ff8d8f75 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 15 Nov 2014 00:29:27 +0100 Subject: clean up --- cmd/mist/gui.go | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 785962ea0..62943fa9e 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -63,6 +63,15 @@ func LoadExtension(path string) (uintptr, error) { return ptr.Interface().(uintptr), nil } */ +/* + vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") + fmt.Printf("Fetched vec with addr: %#x\n", vec) + if errr != nil { + fmt.Println(errr) + } else { + context.SetVar("vec", (unsafe.Pointer)(vec)) + } +*/ var guilogger = logger.NewLogger("GUI") @@ -112,9 +121,10 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden } func (gui *Gui) Start(assetPath string) { - defer gui.txDb.Close() + guilogger.Infoln("Starting GUI") + // Register ethereum functions qml.RegisterTypes("Ethereum", 1, 0, []qml.TypeSpec{{ Init: func(p *xeth.JSBlock, obj qml.Object) { p.Number = 0; p.Hash = "" }, @@ -132,16 +142,6 @@ func (gui *Gui) Start(assetPath string) { context.SetVar("gui", gui) context.SetVar("eth", gui.uiLib) - /* - vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib") - fmt.Printf("Fetched vec with addr: %#x\n", vec) - if errr != nil { - fmt.Println(errr) - } else { - context.SetVar("vec", (unsafe.Pointer)(vec)) - } - */ - // Load the main QML interface data, _ := ethutil.Config.Db.Get([]byte("KeyRing")) @@ -160,7 +160,6 @@ func (gui *Gui) Start(assetPath string) { panic(err) } - guilogger.Infoln("Starting GUI") gui.open = true win.Show() @@ -245,7 +244,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { return gui.eth.KeyManager().KeyPair().AsStrings() } -func (gui *Gui) setInitialChainManager() { +func (gui *Gui) setInitialChain(ancientBlocks bool) { sBlk := gui.eth.ChainManager().LastBlockHash blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { @@ -255,10 +254,6 @@ func (gui *Gui) setInitialChainManager() { } } -type address struct { - Name, Address string -} - func (gui *Gui) loadAddressBook() { view := gui.getObjectByName("infoView") nameReg := gui.pipe.World().Config().Get("NameReg") @@ -385,11 +380,11 @@ func (self *Gui) getObjectByName(objectName string) qml.Object { func (gui *Gui) update() { // We have to wait for qml to be done loading all the windows. for !gui.qmlDone { - time.Sleep(500 * time.Millisecond) + time.Sleep(300 * time.Millisecond) } go func() { - go gui.setInitialChainManager() + go gui.setInitialChain(false) gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() @@ -493,14 +488,7 @@ func (gui *Gui) update() { case <-generalUpdateTicker.C: statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() lastBlockLabel.Set("text", statusText) - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") - /* - if gui.miner != nil { - pow := gui.miner.GetPow() - miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash") - } - */ blockLength := gui.eth.BlockPool().BlocksProcessed chainLength := gui.eth.BlockPool().ChainLength @@ -510,7 +498,6 @@ func (gui *Gui) update() { dlWidget = gui.win.Root().ObjectByName("downloadIndicator") dlLabel = gui.win.Root().ObjectByName("downloadLabel") ) - dlWidget.Set("value", pct) dlLabel.Set("text", fmt.Sprintf("%d / %d", blockLength, chainLength)) @@ -549,7 +536,6 @@ NumGC: %d func (gui *Gui) setPeerInfo() { gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers)) - gui.win.Root().Call("resetPeers") for _, peer := range gui.pipe.Peers() { gui.win.Root().Call("addPeer", peer) -- cgit v1.2.3 From a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 18 Nov 2014 16:58:22 +0100 Subject: Begin of moving objects to types package * Block(s) * Transaction(s) --- cmd/mist/gui.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 62943fa9e..61b66cce3 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -290,7 +291,7 @@ func (self *Gui) loadMergedMiningOptions() { } } -func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { +func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { pipe := xeth.New(gui.eth) nameReg := pipe.World().Config().Get("NameReg") addr := gui.address() @@ -340,7 +341,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) { func (gui *Gui) readPreviousTransactions() { it := gui.txDb.NewIterator() for it.Next() { - tx := chain.NewTransactionFromBytes(it.Value()) + tx := types.NewTransactionFromBytes(it.Value()) gui.insertTransaction("post", tx) @@ -348,7 +349,7 @@ func (gui *Gui) readPreviousTransactions() { it.Release() } -func (gui *Gui) processBlock(block *chain.Block, initial bool) { +func (gui *Gui) processBlock(block *types.Block, initial bool) { name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") b := xeth.NewJSBlock(block) b.Name = name -- cgit v1.2.3 From 9008b155d3c8d2a32c4c8945f1174243d48d4e90 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 10:28:02 +0100 Subject: Renamed `chain` => `core` --- cmd/mist/gui.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 61b66cce3..e58e349d1 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -31,8 +31,8 @@ import ( "time" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/chain/types" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -413,9 +413,9 @@ func (gui *Gui) update() { events := gui.eth.EventMux().Subscribe( eth.ChainSyncEvent{}, eth.PeerListEvent{}, - chain.NewBlockEvent{}, - chain.TxPreEvent{}, - chain.TxPostEvent{}, + core.NewBlockEvent{}, + core.TxPreEvent{}, + core.TxPostEvent{}, ) // nameReg := gui.pipe.World().Config().Get("NameReg") @@ -430,13 +430,13 @@ func (gui *Gui) update() { return } switch ev := ev.(type) { - case chain.NewBlockEvent: + case core.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) } - case chain.TxPreEvent: + case core.TxPreEvent: tx := ev.Tx object := state.GetAccount(gui.address()) @@ -449,7 +449,7 @@ func (gui *Gui) update() { gui.setWalletValue(object.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) - case chain.TxPostEvent: + case core.TxPostEvent: tx := ev.Tx object := state.GetAccount(gui.address()) -- cgit v1.2.3 From a5b27bbc10d6a145152fc2629043c46ef4a9ca71 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 16:44:43 +0100 Subject: Improved and simplified wallet functions and behaviour --- cmd/mist/gui.go | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index e58e349d1..6a28b48f9 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -404,7 +404,6 @@ func (gui *Gui) update() { state := gui.eth.BlockManager().TransState() - unconfirmedFunds := new(big.Int) gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) lastBlockLabel := gui.getObjectByName("lastBlockLabel") @@ -438,15 +437,15 @@ func (gui *Gui) update() { case core.TxPreEvent: tx := ev.Tx - object := state.GetAccount(gui.address()) - if bytes.Compare(tx.Sender(), gui.address()) == 0 { - unconfirmedFunds.Sub(unconfirmedFunds, tx.Value) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - unconfirmedFunds.Add(unconfirmedFunds, tx.Value) - } + tstate := gui.eth.BlockManager().TransState() + cstate := gui.eth.BlockManager().CurrentState() - gui.setWalletValue(object.Balance(), unconfirmedFunds) + taccount := tstate.GetAccount(gui.address()) + caccount := cstate.GetAccount(gui.address()) + unconfirmedFunds := new(big.Int).Sub(taccount.Balance(), caccount.Balance()) + + gui.setWalletValue(taccount.Balance(), unconfirmedFunds) gui.insertTransaction("pre", tx) case core.TxPostEvent: @@ -456,32 +455,18 @@ func (gui *Gui) update() { if bytes.Compare(tx.Sender(), gui.address()) == 0 { object.SubAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "send") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { object.AddAmount(tx.Value) - //gui.getObjectByName("transactionView").Call("addTx", xeth.NewJSTx(tx), "recv") gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } gui.setWalletValue(object.Balance(), nil) state.UpdateStateObject(object) - // case object: - // gui.loadAddressBook() - case eth.PeerListEvent: gui.setPeerInfo() - - /* - case miner.Event: - if ev.Type == miner.Started { - gui.miner = ev.Miner - } else { - gui.miner = nil - } - */ } case <-peerUpdateTicker.C: -- cgit v1.2.3 From 9925916851c00323336e213fc18c83da5fceee94 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 5 Dec 2014 16:26:39 +0100 Subject: upped proto version and modified block pool --- cmd/mist/gui.go | 4 ---- 1 file changed, 4 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 6a28b48f9..0b03cdc1b 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -389,7 +389,6 @@ func (gui *Gui) update() { gui.loadAddressBook() gui.loadMergedMiningOptions() gui.setPeerInfo() - //gui.readPreviousTransactions() }() for _, plugin := range gui.plugins { @@ -417,9 +416,6 @@ func (gui *Gui) update() { core.TxPostEvent{}, ) - // nameReg := gui.pipe.World().Config().Get("NameReg") - // mux.Subscribe("object:"+string(nameReg.Address()), objectChan) - go func() { defer events.Unsubscribe() for { -- cgit v1.2.3 From 5553e5aaed5c3f4e303b7d6671d2c92a45aa487e Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Dec 2014 19:59:12 +0100 Subject: states moved to chain --- cmd/mist/gui.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 0b03cdc1b..fe066e994 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -401,7 +401,7 @@ func (gui *Gui) update() { generalUpdateTicker := time.NewTicker(500 * time.Millisecond) statsUpdateTicker := time.NewTicker(5 * time.Second) - state := gui.eth.BlockManager().TransState() + state := gui.eth.ChainManager().TransState() gui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(state.GetAccount(gui.address()).Balance()))) @@ -428,14 +428,14 @@ func (gui *Gui) update() { case core.NewBlockEvent: gui.processBlock(ev.Block, false) if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { - gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil) + gui.setWalletValue(gui.eth.ChainManager().State().GetBalance(gui.address()), nil) } case core.TxPreEvent: tx := ev.Tx - tstate := gui.eth.BlockManager().TransState() - cstate := gui.eth.BlockManager().CurrentState() + tstate := gui.eth.ChainManager().TransState() + cstate := gui.eth.ChainManager().State() taccount := tstate.GetAccount(gui.address()) caccount := cstate.GetAccount(gui.address()) -- cgit v1.2.3 From 2d09e67713757e2a80eb614562c97f962af36cf7 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 13:17:24 +0100 Subject: Updated to new methods --- cmd/mist/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index fe066e994..773688ffc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -246,7 +246,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { } func (gui *Gui) setInitialChain(ancientBlocks bool) { - sBlk := gui.eth.ChainManager().LastBlockHash + sBlk := gui.eth.ChainManager().LastBlockHash() blk := gui.eth.ChainManager().GetBlock(sBlk) for ; blk != nil; blk = gui.eth.ChainManager().GetBlock(sBlk) { sBlk = blk.PrevHash @@ -468,7 +468,7 @@ func (gui *Gui) update() { case <-peerUpdateTicker.C: gui.setPeerInfo() case <-generalUpdateTicker.C: - statusText := "#" + gui.eth.ChainManager().CurrentBlock.Number.String() + statusText := "#" + gui.eth.ChainManager().CurrentBlock().Number.String() lastBlockLabel.Set("text", statusText) miningLabel.Set("text", "Mining @ "+strconv.FormatInt(gui.uiLib.miner.GetPow().GetHashrate(), 10)+"Khash") -- cgit v1.2.3 From db494170dc819b1eb0d267b6e1ab36c6cfb63569 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:18:13 +0100 Subject: Created generic message (easy for testing) --- cmd/mist/gui.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 773688ffc..46f264f35 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -305,13 +305,13 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { var ( ptx = xeth.NewJSTx(tx, pipe.World().State()) - send = nameReg.Storage(tx.Sender()) - rec = nameReg.Storage(tx.Recipient) + send = nameReg.Storage(tx.From()) + rec = nameReg.Storage(tx.To()) s, r string ) if tx.CreatesContract() { - rec = nameReg.Storage(tx.CreationAddress(pipe.World().State())) + rec = nameReg.Storage(core.AddressFromMessage(tx)) } if send.Len() != 0 { @@ -323,9 +323,9 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { r = strings.Trim(rec.Str(), "\x00") } else { if tx.CreatesContract() { - r = ethutil.Bytes2Hex(tx.CreationAddress(pipe.World().State())) + r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { - r = ethutil.Bytes2Hex(tx.Recipient) + r = ethutil.Bytes2Hex(tx.To()) } } ptx.Sender = s @@ -449,11 +449,11 @@ func (gui *Gui) update() { object := state.GetAccount(gui.address()) if bytes.Compare(tx.Sender(), gui.address()) == 0 { - object.SubAmount(tx.Value) + object.SubAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) - } else if bytes.Compare(tx.Recipient, gui.address()) == 0 { - object.AddAmount(tx.Value) + } else if bytes.Compare(tx.To(), gui.address()) == 0 { + object.AddAmount(tx.Value()) gui.txDb.Put(tx.Hash(), tx.RlpEncode()) } -- cgit v1.2.3 From 5ad473d7581b92811c3a3e035274a82fc5568f57 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 18 Dec 2014 15:33:22 +0100 Subject: Moved methods to messages --- cmd/mist/gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmd/mist/gui.go') diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 46f264f35..7775889cc 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -310,7 +310,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { s, r string ) - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { rec = nameReg.Storage(core.AddressFromMessage(tx)) } @@ -322,7 +322,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) { if rec.Len() != 0 { r = strings.Trim(rec.Str(), "\x00") } else { - if tx.CreatesContract() { + if core.MessageCreatesContract(tx) { r = ethutil.Bytes2Hex(core.AddressFromMessage(tx)) } else { r = ethutil.Bytes2Hex(tx.To()) -- cgit v1.2.3