@@ -88,11 +88,8 @@ func TestIndexerServiceRetriesAfterFetchError(t *testing.T) {
8888 height : 1 ,
8989 headerCh : make (chan coretypes.ResultEvent , 4 ),
9090 }
91- // Exactly ONE failure: recovery then needs a single wake-up token. With two
92- // failures the test needed two tokens, but the new-block signal channel has
93- // capacity 1 and the subscription goroutine coalesces close headers into
94- // one token — under the -race scheduler that interleaving stranded the
95- // second retry on the 60s timeout and tripped the 10s deadline (flake).
91+ // One failure → recovery needs exactly one wake-up token. (Two needed two, but the
92+ // capacity-1 signal channel coalesces close headers into one → the old -race flake.)
9693 client .failuresLeft .Store (1 )
9794 idxr := & mockIndexer {indexed : make (chan int64 , 8 )}
9895
@@ -109,22 +106,16 @@ func TestIndexerServiceRetriesAfterFetchError(t *testing.T) {
109106 }
110107 }
111108
112- // Phase 1 — busy-loop discriminator. Attempt 1 fails on startup catch-up
113- // (height 1) and NO wake-up has been sent: the correct loop must park on
114- // the new-block signal. The pre-fix busy-loop retried the failing fetch
115- // immediately, so it would have recovered and indexed without any signal.
109+ // Phase 1 — busy-loop check: startup catch-up (height 1) fails, no signal sent.
110+ // Correct code parks; a busy-loop retries immediately and indexes without a wake-up.
116111 select {
117112 case h := <- idxr .indexed :
118113 t .Fatalf ("indexed height %d without a wake-up: busy-loop regression" , h )
119- case <- time .After (1500 * time .Millisecond ):
120- // parked, as it should be
114+ case <- time .After (1500 * time .Millisecond ): // parked, as it should be
121115 }
122116
123- // Phase 2 — latch discriminator + recovery. A single signal is a single
124- // retry token: attempt 2 succeeds and the loop catches up through height
125- // 2. Deterministic under any interleaving (recovery needs exactly one
126- // token). The latched pre-fix version never re-enters the fetch, so it
127- // stays parked and trips the deadline.
117+ // Phase 2 — latch check: one signal = one retry token. Correct code clears the error
118+ // and catches up (heights 1–2); the latched variant stays parked and trips the deadline.
128119 signal (2 )
129120
130121 deadline := time .After (10 * time .Second )
0 commit comments