diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-13 23:22:32 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-13 23:22:32 +0800 |
commit | 97d2954e227049a089652d91e6fb0ea1c8115cc6 (patch) | |
tree | ceff72759d6c7c57209fb3852f0f3c646c907f2d /eth/backend.go | |
parent | a8a2b2a488f7433abc09c51b751556875c9107a9 (diff) | |
download | go-tangerine-97d2954e227049a089652d91e6fb0ea1c8115cc6.tar.gz go-tangerine-97d2954e227049a089652d91e6fb0ea1c8115cc6.tar.zst go-tangerine-97d2954e227049a089652d91e6fb0ea1c8115cc6.zip |
eth: added downloader for syncing up the chain
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/eth/backend.go b/eth/backend.go index c7a5b233f..a71d5721e 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" @@ -130,6 +131,7 @@ type Ethereum struct { accountManager *accounts.Manager whisper *whisper.Whisper pow *ethash.Ethash + downloader *downloader.Downloader net *p2p.Server eventMux *event.TypeMux @@ -194,6 +196,7 @@ func New(config *Config) (*Ethereum, error) { } eth.chainManager = core.NewChainManager(blockDb, stateDb, eth.EventMux()) + eth.downloader = downloader.New(eth.chainManager.HasBlock, eth.chainManager.InsertChain, eth.chainManager.Td) eth.pow = ethash.New(eth.chainManager) eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State) eth.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.txPool, eth.chainManager, eth.EventMux()) @@ -212,7 +215,7 @@ func New(config *Config) (*Ethereum, error) { return nil, err } - ethProto := EthProtocol(config.ProtocolVersion, config.NetworkId, eth.txPool, eth.chainManager, eth.blockPool) + ethProto := EthProtocol(config.ProtocolVersion, config.NetworkId, eth.txPool, eth.chainManager, eth.blockPool, eth.downloader) protocols := []p2p.Protocol{ethProto} if config.Shh { protocols = append(protocols, eth.whisper.Protocol()) @@ -349,6 +352,7 @@ func (s *Ethereum) ClientVersion() string { return s.clientVersio func (s *Ethereum) EthVersion() int { return s.ethVersionId } func (s *Ethereum) NetVersion() int { return s.netVersionId } func (s *Ethereum) ShhVersion() int { return s.shhVersionId } +func (s *Ethereum) Downloader() *downloader.Downloader { return s.downloader } // Start the ethereum func (s *Ethereum) Start() error { |