mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
downloader: fixed bug in light mode
This commit is contained in:
parent
31d04569bd
commit
5ab65c3a1b
1 changed files with 4 additions and 2 deletions
|
|
@ -1712,9 +1712,11 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
|
||||||
// L: Sync begins, and finds common ancestor at 11
|
// 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)
|
// L: Request new headers up from 11 (R's TD was higher, it must have something)
|
||||||
// R: Nothing to give
|
// R: Nothing to give
|
||||||
|
if d.mode != LightSync {
|
||||||
if !gotHeaders && td.Cmp(d.getTd(d.headBlock().Hash())) > 0 {
|
if !gotHeaders && td.Cmp(d.getTd(d.headBlock().Hash())) > 0 {
|
||||||
return errStallingPeer
|
return errStallingPeer
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// If fast or light syncing, ensure promised headers are indeed delivered. This is
|
// 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
|
// needed to detect scenarios where an attacker feeds a bad pivot and then bails out
|
||||||
// of delivering the post-pivot blocks that would flag the invalid content.
|
// of delivering the post-pivot blocks that would flag the invalid content.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue