aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go83
1 files changed, 20 insertions, 63 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 8c2073574..7685f3568 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
ethlogger "github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/nat"
@@ -25,6 +26,7 @@ var (
defaultBootNodes = []*discover.Node{
discover.MustParseNode("enode://6cdd090303f394a1cac34ecc9f7cda18127eafa2a3a06de39f6d920b0e583e062a7362097c7c65ee490a758b442acd5c80c6fce4b148c6a391e946b45131365b@54.169.166.226:30303"),
+ discover.MustParseNode("enode://d1760a33c2f25c3b419ee4f6787fb0ea148828f5e678f0450d4be978fef908b42fc47a4c0fbf19832754f17881d381e50364fa93be42f31801d60ac64933f0a5@127.0.0.1:30303"),
}
)
@@ -95,6 +97,7 @@ type Ethereum struct {
eventMux *event.TypeMux
txSub event.Subscription
blockSub event.Subscription
+ miner *miner.Miner
RpcServer rpc.RpcServer
WsServer rpc.RpcServer
@@ -151,6 +154,7 @@ func New(config *Config) (*Ethereum, error) {
eth.blockProcessor = core.NewBlockProcessor(db, eth.txPool, eth.chainManager, eth.EventMux())
eth.chainManager.SetProcessor(eth.blockProcessor)
eth.whisper = whisper.New()
+ eth.miner = miner.New(keyManager.Address(), eth)
hasBlock := eth.chainManager.HasBlock
insertChain := eth.chainManager.InsertChain
@@ -181,69 +185,22 @@ func New(config *Config) (*Ethereum, error) {
return eth, nil
}
-func (s *Ethereum) KeyManager() *crypto.KeyManager {
- return s.keyManager
-}
-
-func (s *Ethereum) Logger() ethlogger.LogSystem {
- return s.logger
-}
-
-func (s *Ethereum) Name() string {
- return s.net.Name
-}
-
-func (s *Ethereum) ChainManager() *core.ChainManager {
- return s.chainManager
-}
-
-func (s *Ethereum) BlockProcessor() *core.BlockProcessor {
- return s.blockProcessor
-}
-
-func (s *Ethereum) TxPool() *core.TxPool {
- return s.txPool
-}
-
-func (s *Ethereum) BlockPool() *BlockPool {
- return s.blockPool
-}
-
-func (s *Ethereum) Whisper() *whisper.Whisper {
- return s.whisper
-}
-
-func (s *Ethereum) EventMux() *event.TypeMux {
- return s.eventMux
-}
-func (self *Ethereum) Db() ethutil.Database {
- return self.db
-}
-
-func (s *Ethereum) IsMining() bool {
- return s.Mining
-}
-
-func (s *Ethereum) IsListening() bool {
- // XXX TODO
- return false
-}
-
-func (s *Ethereum) PeerCount() int {
- return s.net.PeerCount()
-}
-
-func (s *Ethereum) Peers() []*p2p.Peer {
- return s.net.Peers()
-}
-
-func (s *Ethereum) MaxPeers() int {
- return s.net.MaxPeers
-}
-
-func (s *Ethereum) Coinbase() []byte {
- return nil // TODO
-}
+func (s *Ethereum) KeyManager() *crypto.KeyManager { return s.keyManager }
+func (s *Ethereum) Logger() ethlogger.LogSystem { return s.logger }
+func (s *Ethereum) Name() string { return s.net.Name }
+func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager }
+func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor }
+func (s *Ethereum) TxPool() *core.TxPool { return s.txPool }
+func (s *Ethereum) BlockPool() *BlockPool { return s.blockPool }
+func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper }
+func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux }
+func (s *Ethereum) Db() ethutil.Database { return s.db }
+func (s *Ethereum) Miner() *miner.Miner { return s.miner }
+func (s *Ethereum) IsListening() bool { return true } // Always listening
+func (s *Ethereum) PeerCount() int { return s.net.PeerCount() }
+func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() }
+func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers }
+func (s *Ethereum) Coinbase() []byte { return nil } // TODO
// Start the ethereum
func (s *Ethereum) Start() error {