Added ui.Interface to xeth

This commit is contained in:
obscuren
2015-03-09 13:49:14 +01:00
parent 21fd722abc
commit 738d6e20f2
2 changed files with 18 additions and 15 deletions

View File

@ -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