Merge pull request #24545 from karalabe/beacon-sync-fix-test

eth/downloader: fix off-by-one error in test causing 50% fails
This commit is contained in:
Péter Szilágyi 2022-03-16 09:01:04 +02:00 committed by GitHub
commit 2352c72229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -742,13 +742,13 @@ func TestSkeletonSyncRetrievals(t *testing.T) {
head: chain[2*requestHeaders], head: chain[2*requestHeaders],
peers: []*skeletonTestPeer{ peers: []*skeletonTestPeer{
newSkeletonTestPeerWithHook("peer-1", chain, func(origin uint64) []*types.Header { newSkeletonTestPeerWithHook("peer-1", chain, func(origin uint64) []*types.Header {
if origin == chain[2*requestHeaders+2].Number.Uint64() { if origin == chain[2*requestHeaders+1].Number.Uint64() {
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
} }
return nil // Fallback to default behavior, just delayed return nil // Fallback to default behavior, just delayed
}), }),
newSkeletonTestPeerWithHook("peer-2", chain, func(origin uint64) []*types.Header { newSkeletonTestPeerWithHook("peer-2", chain, func(origin uint64) []*types.Header {
if origin == chain[2*requestHeaders+2].Number.Uint64() { if origin == chain[2*requestHeaders+1].Number.Uint64() {
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
} }
return nil // Fallback to default behavior, just delayed return nil // Fallback to default behavior, just delayed