diff options
author | Alexandre Van de Sande <alex.vandesande@ethdev.com> | 2015-02-17 19:29:10 +0800 |
---|---|---|
committer | Alexandre Van de Sande <alex.vandesande@ethdev.com> | 2015-02-17 19:29:10 +0800 |
commit | abb9b7f46ff3b2ef0bb4f2e95f029591688768c4 (patch) | |
tree | c4088c788b3e86935a2b8fd2fbe157340476f091 /eth/backend.go | |
parent | fbd5e4d5afeaff6c250a3a953b18476cdb4b86ae (diff) | |
parent | c934222a8089b19587242a3b0bc71ea0aec1d5ef (diff) | |
download | go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.gz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.bz2 go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.lz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.xz go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.tar.zst go-tangerine-abb9b7f46ff3b2ef0bb4f2e95f029591688768c4.zip |
Merge branch 'develop' into ui
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 82 |
1 files changed, 19 insertions, 63 deletions
diff --git a/eth/backend.go b/eth/backend.go index 8c2073574..690c7136d 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" @@ -95,6 +96,7 @@ type Ethereum struct { eventMux *event.TypeMux txSub event.Subscription blockSub event.Subscription + miner *miner.Miner RpcServer rpc.RpcServer WsServer rpc.RpcServer @@ -151,6 +153,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 +184,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 { |