eth, les, light: enforce CHT checkpoints on fast-sync too

This commit is contained in:
Péter Szilágyi
2019-04-16 13:20:38 +03:00
parent 78d90c47f7
commit 38f6b85638
11 changed files with 208 additions and 112 deletions

View File

@ -174,9 +174,12 @@ func NewProtocolManager(
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.CHTFrequency - 1
}
manager.downloader = downloader.New(downloader.LightSync, checkpoint, chainDb, manager.eventMux, nil, blockchain, removePeer)
manager.peers.notify((*downloaderPeerNotify)(manager))
manager.fetcher = newLightFetcher(manager)
}