aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
committerobscuren <geffobscura@gmail.com>2015-03-10 00:55:01 +0800
commit8560004f380dc688a1171ad5aeffa593aae41193 (patch)
treefea395acf042b51e97a86e2c4cbcf8c16b2912b7 /xeth
parent9723191b19f6ddc12f0c3376ede7529b2d72e6a2 (diff)
parent676a0de58d3d7c508b0eeeff192d2095a46f7382 (diff)
downloaddexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.gz
dexon-8560004f380dc688a1171ad5aeffa593aae41193.tar.zst
dexon-8560004f380dc688a1171ad5aeffa593aae41193.zip
wip
Diffstat (limited to 'xeth')
-rw-r--r--xeth/state.go2
-rw-r--r--xeth/xeth.go26
2 files changed, 17 insertions, 11 deletions
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 091743a95..c0281f1da 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"
)
@@ -32,7 +33,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
@@ -45,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(),
@@ -55,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
@@ -300,14 +314,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