aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-10-09 23:36:31 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-10-19 15:03:10 +0800
commitaa0538db0b5de2bb2c609d629b65d083649f9171 (patch)
treea1ce77d4fa8d041a78975b6f99067e85eb725ea1 /eth/handler.go
parenta9d8dfc8e77330412b1f21e25a69b96d59567e36 (diff)
downloadgo-tangerine-aa0538db0b5de2bb2c609d629b65d083649f9171.tar.gz
go-tangerine-aa0538db0b5de2bb2c609d629b65d083649f9171.tar.zst
go-tangerine-aa0538db0b5de2bb2c609d629b65d083649f9171.zip
eth: clean out light node notions from eth
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go17
1 files changed, 6 insertions, 11 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 40a578842..725178035 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -55,7 +55,7 @@ type hashFetcherFn func(common.Hash) error
type blockFetcherFn func([]common.Hash) error
type ProtocolManager struct {
- mode Mode
+ fastSync bool
txpool txPool
blockchain *core.BlockChain
chaindb ethdb.Database
@@ -83,10 +83,10 @@ type ProtocolManager struct {
// NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable
// with the ethereum network.
-func NewProtocolManager(mode Mode, networkId int, mux *event.TypeMux, txpool txPool, pow pow.PoW, blockchain *core.BlockChain, chaindb ethdb.Database) (*ProtocolManager, error) {
+func NewProtocolManager(fastSync bool, networkId int, mux *event.TypeMux, txpool txPool, pow pow.PoW, blockchain *core.BlockChain, chaindb ethdb.Database) (*ProtocolManager, error) {
// Create the protocol manager with the base fields
manager := &ProtocolManager{
- mode: mode,
+ fastSync: fastSync,
eventMux: mux,
txpool: txpool,
blockchain: blockchain,
@@ -100,7 +100,7 @@ func NewProtocolManager(mode Mode, networkId int, mux *event.TypeMux, txpool txP
manager.SubProtocols = make([]p2p.Protocol, 0, len(ProtocolVersions))
for i, version := range ProtocolVersions {
// Skip protocol version if incompatible with the mode of operation
- if minimumProtocolVersion[mode] > version {
+ if fastSync && version < eth63 {
continue
}
// Compatible, initialize the sub-protocol
@@ -120,14 +120,9 @@ func NewProtocolManager(mode Mode, networkId int, mux *event.TypeMux, txpool txP
return nil, errIncompatibleConfig
}
// Construct the different synchronisation mechanisms
- var syncMode downloader.SyncMode
- switch mode {
- case ArchiveMode:
- syncMode = downloader.FullSync
- case FullMode:
+ syncMode := downloader.FullSync
+ if fastSync {
syncMode = downloader.FastSync
- case LightMode:
- syncMode = downloader.LightSync
}
manager.downloader = downloader.New(syncMode, chaindb, manager.eventMux, blockchain.HasHeader, blockchain.HasBlock, blockchain.GetHeader,
blockchain.GetBlock, blockchain.CurrentHeader, blockchain.CurrentBlock, blockchain.CurrentFastBlock, blockchain.FastSyncCommitHead,