This commit is contained in:
Mikhail Kuznetsov 2026-07-18 12:41:37 +04:00 committed by GitHub
commit 725ac90c82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 11 deletions

View file

@ -456,8 +456,8 @@ func testCanonSync(t *testing.T, protocol uint, mode SyncMode, snapV2 bool) {
select { select {
case <-success: case <-success:
assertOwnChain(t, tester, len(chain.blocks)) assertOwnChain(t, tester, len(chain.blocks))
case <-time.NewTimer(time.Second * 3).C: case <-time.NewTimer(time.Second * 30).C:
t.Fatalf("Failed to sync chain in three seconds") t.Fatalf("Failed to sync chain in time")
} }
} }
@ -605,8 +605,8 @@ func testEmptyShortCircuit(t *testing.T, protocol uint, mode SyncMode) {
HighestBlock: uint64(len(chain.blocks) - 1), HighestBlock: uint64(len(chain.blocks) - 1),
CurrentBlock: uint64(len(chain.blocks) - 1), CurrentBlock: uint64(len(chain.blocks) - 1),
}) })
case <-time.NewTimer(time.Second * 3).C: case <-time.NewTimer(time.Second * 30).C:
t.Fatalf("Failed to sync chain in three seconds") t.Fatalf("Failed to sync chain in time")
} }
assertOwnChain(t, tester, len(chain.blocks)) assertOwnChain(t, tester, len(chain.blocks))
@ -679,8 +679,8 @@ func testBeaconSync(t *testing.T, protocol uint, mode SyncMode) {
if bs := int(tester.chain.CurrentBlock().Number.Uint64()) + 1; bs != len(chain.blocks) { if bs := int(tester.chain.CurrentBlock().Number.Uint64()) + 1; bs != len(chain.blocks) {
t.Fatalf("synchronised blocks mismatch: have %v, want %v", bs, len(chain.blocks)) t.Fatalf("synchronised blocks mismatch: have %v, want %v", bs, len(chain.blocks))
} }
case <-time.NewTimer(time.Second * 3).C: case <-time.NewTimer(time.Second * 30).C:
t.Fatalf("Failed to sync chain in three seconds") t.Fatalf("Failed to sync chain in time")
} }
}) })
} }
@ -790,8 +790,8 @@ func testSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
CurrentBlock: uint64(len(chain.blocks)/2 - 1), CurrentBlock: uint64(len(chain.blocks)/2 - 1),
HighestBlock: uint64(len(chain.blocks)/2 - 1), HighestBlock: uint64(len(chain.blocks)/2 - 1),
}) })
case <-time.NewTimer(time.Second * 3).C: case <-time.NewTimer(time.Second * 30).C:
t.Fatalf("Failed to sync chain in three seconds") t.Fatalf("Failed to sync chain in time")
} }
// Synchronise all the blocks and check continuation progress // Synchronise all the blocks and check continuation progress
@ -809,8 +809,8 @@ func testSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
CurrentBlock: uint64(len(chain.blocks) - 1), CurrentBlock: uint64(len(chain.blocks) - 1),
HighestBlock: uint64(len(chain.blocks) - 1), HighestBlock: uint64(len(chain.blocks) - 1),
}) })
case <-time.NewTimer(time.Second * 3).C: case <-time.NewTimer(time.Second * 30).C:
t.Fatalf("Failed to sync chain in three seconds") t.Fatalf("Failed to sync chain in time")
} }
} }

View file

@ -922,7 +922,14 @@ func TestSkeletonSyncRetrievals(t *testing.T) {
endpeers = append(tt.peers, tt.newPeer) endpeers = append(tt.peers, tt.newPeer)
} }
if tt.newHead != nil { if tt.newHead != nil {
skeleton.Sync(tt.newHead, nil, true) // The head announcement is rejected if it arrives while the previous
// sync cycle is still tearing down (head events are dropped on the
// floor during teardown, see #27397). Retry until the syncer accepts
// the new head, otherwise the update is lost and the end state below
// is never reached.
for skeleton.Sync(tt.newHead, nil, true) != nil {
time.Sleep(10 * time.Millisecond)
}
} }
// Wait a bit (bleah) for the second sync loop to go to idle. This might // Wait a bit (bleah) for the second sync loop to go to idle. This might