downloader: fixed bug in light mode

This commit is contained in:
zsfelfoldi 2016-06-20 14:54:55 +02:00
parent 31d04569bd
commit 5ab65c3a1b

View file

@ -1712,8 +1712,10 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
// L: Sync begins, and finds common ancestor at 11
// L: Request new headers up from 11 (R's TD was higher, it must have something)
// R: Nothing to give
if !gotHeaders && td.Cmp(d.getTd(d.headBlock().Hash())) > 0 {
return errStallingPeer
if d.mode != LightSync {
if !gotHeaders && td.Cmp(d.getTd(d.headBlock().Hash())) > 0 {
return errStallingPeer
}
}
// If fast or light syncing, ensure promised headers are indeed delivered. This is
// needed to detect scenarios where an attacker feeds a bad pivot and then bails out