From c17a0ebe45958741d84942f6dc71f0d8050252d1 Mon Sep 17 00:00:00 2001 From: Sonic Date: Fri, 19 Apr 2019 12:32:53 +0800 Subject: dex/downloader: fix find common ancestor (#376) --- dex/downloader/downloader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dex') diff --git a/dex/downloader/downloader.go b/dex/downloader/downloader.go index 9d609584b..0847cd062 100644 --- a/dex/downloader/downloader.go +++ b/dex/downloader/downloader.go @@ -848,7 +848,7 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header) default: known = d.lightchain.HasHeader(h, n) } - if known { + if n <= localHeight && known { number, hash = n, h break } @@ -919,7 +919,7 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header) default: known = d.lightchain.HasHeader(h, n) } - if !known { + if !known || n > localHeight { end = check break } -- cgit