From ac88ae86a3f6fa5d5a957bac9d96e0a2027ac068 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 1 Mar 2015 19:07:38 +0100 Subject: GetOrNew for accessors. Fixes #404 --- xeth/xeth.go | 8 -------- 1 file changed, 8 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index d4c188fec..677d40fd5 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -300,14 +300,6 @@ func (self *XEth) Transact(toStr, valueStr, gasStr, gasPriceStr, codeStr string) tx.SetNonce(nonce) tx.Sign(key.PrivateKey) - //fmt.Printf("create tx: %x %v\n", tx.Hash()[:4], tx.Nonce()) - - // Do some pre processing for our "pre" events and hooks - //block := self.chainManager.NewBlock(key.Address()) - //coinbase := state.GetOrNewStateObject(key.Address()) - //coinbase.SetGasPool(block.GasLimit()) - //self.blockProcessor.ApplyTransactions(coinbase, state, block, types.Transactions{tx}, true) - err = self.eth.TxPool().Add(tx) if err != nil { return "", err -- cgit From cd856cb2133d390758bb24b88fa3b538bb7bc306 Mon Sep 17 00:00:00 2001 From: obscuren Date: Fri, 6 Mar 2015 18:26:16 +0100 Subject: Separated block db from state db. Partial fix for #416 --- xeth/state.go | 2 +- xeth/xeth.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'xeth') diff --git a/xeth/state.go b/xeth/state.go index e2562613c..0f6a042b3 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -26,7 +26,7 @@ func (self *State) SafeGet(addr string) *Object { func (self *State) safeGet(addr string) *state.StateObject { object := self.state.GetStateObject(fromHex(addr)) if object == nil { - object = state.NewStateObject(fromHex(addr), self.xeth.eth.Db()) + object = state.NewStateObject(fromHex(addr), self.xeth.eth.StateDb()) } return object diff --git a/xeth/xeth.go b/xeth/xeth.go index 677d40fd5..6ee581e4e 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -32,7 +32,8 @@ type Backend interface { IsListening() bool Peers() []*p2p.Peer KeyManager() *crypto.KeyManager - Db() ethutil.Database + BlockDb() ethutil.Database + StateDb() ethutil.Database EventMux() *event.TypeMux Whisper() *whisper.Whisper Miner() *miner.Miner -- cgit From 738d6e20f2a229aab15b767cb8ca2d2f9c2f9aa8 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 9 Mar 2015 13:49:14 +0100 Subject: Added ui.Interface to xeth --- xeth/xeth.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 6ee581e4e..88ae253cd 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -18,6 +18,7 @@ import ( "github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/state" + "github.com/ethereum/go-ethereum/ui" "github.com/ethereum/go-ethereum/whisper" ) @@ -46,9 +47,16 @@ type XEth struct { state *State whisper *Whisper miner *miner.Miner + + frontend ui.Interface } -func New(eth Backend) *XEth { +type TmpFrontend struct{} + +func (TmpFrontend) UnlockAccount([]byte) bool { panic("UNLOCK ACCOUNT") } +func (TmpFrontend) ConfirmTransaction(*types.Transaction) bool { panic("CONFIRM TRANSACTION") } + +func New(eth Backend, frontend ui.Interface) *XEth { xeth := &XEth{ eth: eth, blockProcessor: eth.BlockProcessor(), @@ -56,6 +64,11 @@ func New(eth Backend) *XEth { whisper: NewWhisper(eth.Whisper()), miner: eth.Miner(), } + + if frontend == nil { + xeth.frontend = TmpFrontend{} + } + xeth.state = NewState(xeth, xeth.chainManager.TransState()) return xeth -- cgit