Skip to content

Commit 89030ec

Browse files
authored
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 108033e.
1 parent 889f564 commit 89030ec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

eth/downloader/downloader_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,15 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) {
584584
time.Sleep(25 * time.Millisecond)
585585

586586
tester.lock.Lock()
587+
tester.downloader.queue.lock.Lock()
588+
tester.downloader.queue.resultCache.lock.Lock()
587589
{
588-
tester.downloader.queue.resultCache.lock.Lock()
589590
cached = tester.downloader.queue.resultCache.countCompleted()
590-
tester.downloader.queue.resultCache.lock.Unlock()
591591
frozen = int(atomic.LoadUint32(&blocked))
592592
retrieved = len(tester.ownBlocks)
593-
594593
}
594+
tester.downloader.queue.resultCache.lock.Unlock()
595+
tester.downloader.queue.lock.Unlock()
595596
tester.lock.Unlock()
596597

597598
if cached == blockCacheMaxItems ||

0 commit comments

Comments
 (0)