aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-17 19:24:51 +0800
committerobscuren <geffobscura@gmail.com>2015-02-17 19:24:58 +0800
commit8135752a32837748e6d4a986912131736b1a0aa0 (patch)
tree0ad3b6abab8a4b0c013844f93ca665526d2a567a /xeth/xeth.go
parent164de5e22be39ba2bdc58f84f72572252634e7e1 (diff)
downloaddexon-8135752a32837748e6d4a986912131736b1a0aa0.tar.gz
dexon-8135752a32837748e6d4a986912131736b1a0aa0.tar.zst
dexon-8135752a32837748e6d4a986912131736b1a0aa0.zip
"centralised" mining to backend. Closes #323
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 75d83f80b..27435b956 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"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"
@@ -27,13 +28,13 @@ type Backend interface {
ChainManager() *core.ChainManager
TxPool() *core.TxPool
PeerCount() int
- IsMining() bool
IsListening() bool
Peers() []*p2p.Peer
KeyManager() *crypto.KeyManager
Db() ethutil.Database
EventMux() *event.TypeMux
Whisper() *whisper.Whisper
+ Miner() *miner.Miner
}
type XEth struct {
@@ -42,6 +43,7 @@ type XEth struct {
chainManager *core.ChainManager
state *State
whisper *Whisper
+ miner *miner.Miner
}
func New(eth Backend) *XEth {
@@ -50,15 +52,17 @@ func New(eth Backend) *XEth {
blockProcessor: eth.BlockProcessor(),
chainManager: eth.ChainManager(),
whisper: NewWhisper(eth.Whisper()),
+ miner: eth.Miner(),
}
xeth.state = NewState(xeth)
return xeth
}
-func (self *XEth) Backend() Backend { return self.eth }
-func (self *XEth) State() *State { return self.state }
-func (self *XEth) Whisper() *Whisper { return self.whisper }
+func (self *XEth) Backend() Backend { return self.eth }
+func (self *XEth) State() *State { return self.state }
+func (self *XEth) Whisper() *Whisper { return self.whisper }
+func (self *XEth) Miner() *miner.Miner { return self.miner }
func (self *XEth) BlockByHash(strHash string) *Block {
hash := fromHex(strHash)
@@ -96,7 +100,7 @@ func (self *XEth) PeerCount() int {
}
func (self *XEth) IsMining() bool {
- return self.eth.IsMining()
+ return self.miner.Mining()
}
func (self *XEth) IsListening() bool {