aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-10-04 21:36:59 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-10-05 15:45:02 +0800
commit6ee3b26f447459d3f3a316dbb572e461a273e193 (patch)
tree39629411ceb3326b70313d3e3eba4440e30d0ace /eth/downloader/downloader_test.go
parent89a32451aeb418db3fd5d9c427a0c29fddb1e85b (diff)
downloadgo-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar.gz
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar.bz2
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar.lz
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar.xz
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.tar.zst
go-tangerine-6ee3b26f447459d3f3a316dbb572e461a273e193.zip
eth/downloader: fix invalid hash chain error due to head mini reorg
Diffstat (limited to 'eth/downloader/downloader_test.go')
-rw-r--r--eth/downloader/downloader_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index d1a9a8694..dad626e89 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -744,7 +744,7 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
tester.downloader.queue.lock.Unlock()
tester.lock.Unlock()
- if cached == blockCacheItems || retrieved+cached+frozen == targetBlocks+1 {
+ if cached == blockCacheItems || cached == blockCacheItems-reorgProtHeaderDelay || retrieved+cached+frozen == targetBlocks+1 || retrieved+cached+frozen == targetBlocks+1-reorgProtHeaderDelay {
break
}
}
@@ -754,7 +754,7 @@ func testThrottling(t *testing.T, protocol int, mode SyncMode) {
tester.lock.RLock()
retrieved = len(tester.ownBlocks)
tester.lock.RUnlock()
- if cached != blockCacheItems && retrieved+cached+frozen != targetBlocks+1 {
+ if cached != blockCacheItems && cached != blockCacheItems-reorgProtHeaderDelay && retrieved+cached+frozen != targetBlocks+1 && retrieved+cached+frozen != targetBlocks+1-reorgProtHeaderDelay {
t.Fatalf("block count mismatch: have %v, want %v (owned %v, blocked %v, target %v)", cached, blockCacheItems, retrieved, frozen, targetBlocks+1)
}
// Permit the blocked blocks to import