good morning!!!!

Skip to content
Snippets Groups Projects
Commit 6d41402d authored by Taylor Gerring's avatar Taylor Gerring
Browse files

Backend no longer needed to resolve import cycle

parent 9de1ad65
Branches
Tags
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment