diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-04-17 20:47:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 20:47:54 +0800 |
commit | 4bcc0a37ab70cb79b16893556cffdaad6974e7d8 (patch) | |
tree | 13a20867c5df35d41655991195e92bd1e5c25de0 /les | |
parent | cdae1c59abc32f85debfa29577fbf1ed036ebf73 (diff) | |
parent | b5f92e66c6df3594430ced80334d0217ddb9ec34 (diff) | |
download | go-tangerine-1.8.27.tar go-tangerine-1.8.27.tar.gz go-tangerine-1.8.27.tar.bz2 go-tangerine-1.8.27.tar.lz go-tangerine-1.8.27.tar.xz go-tangerine-1.8.27.tar.zst go-tangerine-1.8.27.zip |
Merge pull request #19473 from karalabe/geth-1.8.27v1.8.27
[1.8.27 backport] eth, les, light: enforce CHT checkpoints on fast-sync too
Diffstat (limited to 'les')
-rw-r--r-- | les/handler.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/les/handler.go b/les/handler.go index 2fb2067dd..718a2ed68 100644 --- a/les/handler.go +++ b/les/handler.go @@ -153,9 +153,12 @@ func NewProtocolManager(chainConfig *params.ChainConfig, indexerConfig *light.In if disableClientRemovePeer { removePeer = func(id string) {} } - if lightSync { - manager.downloader = downloader.New(downloader.LightSync, chainDb, manager.eventMux, nil, blockchain, removePeer) + var checkpoint uint64 + if cht, ok := params.TrustedCheckpoints[blockchain.Genesis().Hash()]; ok { + checkpoint = (cht.SectionIndex+1)*params.CHTFrequencyClient - 1 + } + manager.downloader = downloader.New(downloader.LightSync, checkpoint, chainDb, manager.eventMux, nil, blockchain, removePeer) manager.peers.notify((*downloaderPeerNotify)(manager)) manager.fetcher = newLightFetcher(manager) } |