aboutsummaryrefslogtreecommitdiffstats
path: root/les
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-04-17 19:50:51 +0800
committerGitHub <noreply@github.com>2019-04-17 19:50:51 +0800
commitf496927a93e2d9cea638e4a65065a31291568f5a (patch)
tree1e63601c363cd633f0ab0ff875714a1a2e963a18 /les
parent921b3160db1359cf13b379dee22e6b02fcfeda89 (diff)
parent38f6b8563828e089f1445bc703662e3ec4716fb9 (diff)
downloadgo-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar.gz
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar.bz2
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar.lz
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar.xz
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.tar.zst
go-tangerine-f496927a93e2d9cea638e4a65065a31291568f5a.zip
Merge pull request #19468 from karalabe/enforce-fastsync-checkpoints
eth, les, light: enforce CHT checkpoints on fast-sync too
Diffstat (limited to 'les')
-rw-r--r--les/handler.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/les/handler.go b/les/handler.go
index 732cb6042..d46eeb03a 100644
--- a/les/handler.go
+++ b/les/handler.go
@@ -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)
}