diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-04-16 18:20:38 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-04-17 19:56:58 +0800 |
commit | d8787230faa07e078a183765271313a7d2c6bdf2 (patch) | |
tree | d31d955dd0cc0b44a7ba5a9ee0097f8e148e0db5 /les | |
parent | cdae1c59abc32f85debfa29577fbf1ed036ebf73 (diff) | |
download | go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar.gz go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar.bz2 go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar.lz go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar.xz go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.tar.zst go-tangerine-d8787230faa07e078a183765271313a7d2c6bdf2.zip |
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) } |