aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 22:36:39 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-24 22:36:39 +0800
commit6d41402dcee01e4e1d03f461b5566df3dfe8e080 (patch)
tree74359eaae7ed04e91fb9c45d74d916f976a496ab /xeth
parent9de1ad65460898ab79c02ce076f1a2b0a7144656 (diff)
downloaddexon-6d41402dcee01e4e1d03f461b5566df3dfe8e080.tar.gz
dexon-6d41402dcee01e4e1d03f461b5566df3dfe8e080.tar.zst
dexon-6d41402dcee01e4e1d03f461b5566df3dfe8e080.zip
Backend no longer needed to resolve import cycle
Diffstat (limited to 'xeth')
-rw-r--r--xeth/xeth.go34
1 files changed, 4 insertions, 30 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 98f5f5b36..3cf3b6d61 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -15,12 +15,10 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
- "github.com/ethereum/go-ethereum/p2p"
- "github.com/ethereum/go-ethereum/whisper"
)
var (
@@ -30,30 +28,6 @@ var (
defaultGas = big.NewInt(90000) //500000
)
-// to resolve the import cycle
-type Backend interface {
- BlockProcessor() *core.BlockProcessor
- ChainManager() *core.ChainManager
- AccountManager() *accounts.Manager
- TxPool() *core.TxPool
- PeerCount() int
- IsListening() bool
- Peers() []*p2p.Peer
- BlockDb() common.Database
- StateDb() common.Database
- ExtraDb() common.Database
- EventMux() *event.TypeMux
- Whisper() *whisper.Whisper
- Miner() *miner.Miner
-
- IsMining() bool
- StartMining() error
- StopMining()
- Version() string
- ProtocolVersion() int
- NetworkId() int
-}
-
// Frontend should be implemented by users of XEth. Its methods are
// called whenever XEth makes a decision that requires user input.
type Frontend interface {
@@ -82,7 +56,7 @@ func (dummyFrontend) UnlockAccount([]byte) bool { return false
func (dummyFrontend) ConfirmTransaction(*types.Transaction) bool { return true }
type XEth struct {
- eth Backend
+ eth *eth.Ethereum
blockProcessor *core.BlockProcessor
chainManager *core.ChainManager
accountManager *accounts.Manager
@@ -110,7 +84,7 @@ type XEth struct {
// New creates an XEth that uses the given frontend.
// If a nil Frontend is provided, a default frontend which
// confirms all transactions will be used.
-func New(eth Backend, frontend Frontend) *XEth {
+func New(eth *eth.Ethereum, frontend Frontend) *XEth {
xeth := &XEth{
eth: eth,
blockProcessor: eth.BlockProcessor(),
@@ -195,7 +169,7 @@ func (self *XEth) AtStateNum(num int64) *XEth {
return self.WithState(st)
}
-func (self *XEth) Backend() Backend { return self.eth }
+func (self *XEth) Backend() *eth.Ethereum { return self.eth }
func (self *XEth) WithState(statedb *state.StateDB) *XEth {
xeth := &XEth{
eth: self.eth,