eth/downloader: enable unsync-protection for light client (#19496)

* eth/downloader: enable unsync-protection for light client

* eth/downloader: fix tests
This commit is contained in:
gary rong
2019-04-25 16:31:23 +08:00
committed by Péter Szilágyi
parent 6269e5574c
commit 749ccab9a4
2 changed files with 3 additions and 3 deletions

View File

@ -580,7 +580,7 @@ func (d *Downloader) fetchHeight(p *peerConnection) (*types.Header, error) {
return nil, errBadPeer
}
head := headers[0]
if d.mode == FastSync && head.Number.Uint64() < d.checkpoint {
if (d.mode == FastSync || d.mode == LightSync) && head.Number.Uint64() < d.checkpoint {
p.log.Warn("Remote head below checkpoint", "number", head.Number, "hash", head.Hash())
return nil, errUnsyncedPeer
}