diff options
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r-- | xeth/xeth.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 9f183aa61..23e523980 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -17,6 +17,7 @@ import ( "github.com/ethereum/go-ethereum/event" "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/state" "github.com/ethereum/go-ethereum/whisper" @@ -43,6 +44,7 @@ type Backend interface { ExtraDb() common.Database EventMux() *event.TypeMux Whisper() *whisper.Whisper + Miner() *miner.Miner IsMining() bool StartMining() error @@ -98,6 +100,9 @@ type XEth struct { // regmut sync.Mutex // register map[string][]*interface{} // TODO improve return type + + // Miner agent + agent *miner.RemoteAgent } // New creates an XEth that uses the given frontend. @@ -115,7 +120,10 @@ func New(eth Backend, frontend Frontend) *XEth { frontend: frontend, logs: make(map[int]*logFilter), messages: make(map[int]*whisperFilter), + agent: miner.NewRemoteAgent(), } + eth.Miner().Register(xeth.agent) + if frontend == nil { xeth.frontend = dummyFrontend{} } @@ -162,6 +170,8 @@ func (self *XEth) stop() { func (self *XEth) DefaultGas() *big.Int { return defaultGas } func (self *XEth) DefaultGasPrice() *big.Int { return defaultGasPrice } +func (self *XEth) RemoteMining() *miner.RemoteAgent { return self.agent } + func (self *XEth) AtStateNum(num int64) *XEth { chain := self.Backend().ChainManager() var block *types.Block |