From 89030ec0b442a08fb82d4452f3132ab1602b8182 Mon Sep 17 00:00:00 2001 From: Chris Ziogas Date: Sat, 9 Jan 2021 18:29:19 +0200 Subject: [PATCH] eth/downloader: fix race condition in tests (#22140) * downloader: fix race condition in tests * eth/downloader: fix race condition in tests * Revert "downloader: fix race condition in tests" This reverts commit 108033ebc6985de83791d375b6e6647a77d28d5a. --- eth/downloader/downloader_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 6578275d0..5de1ef3f8 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -584,14 +584,15 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) { time.Sleep(25 * time.Millisecond) tester.lock.Lock() + tester.downloader.queue.lock.Lock() + tester.downloader.queue.resultCache.lock.Lock() { - tester.downloader.queue.resultCache.lock.Lock() cached = tester.downloader.queue.resultCache.countCompleted() - tester.downloader.queue.resultCache.lock.Unlock() frozen = int(atomic.LoadUint32(&blocked)) retrieved = len(tester.ownBlocks) - } + tester.downloader.queue.resultCache.lock.Unlock() + tester.downloader.queue.lock.Unlock() tester.lock.Unlock() if cached == blockCacheMaxItems ||