Skip to content

Commit

Permalink
core: fix potential race in chainIndexerTest (ethereum#22346)
Browse files Browse the repository at this point in the history
  • Loading branch information
s1na authored and atif-konasl committed Oct 15, 2021
1 parent c008ba4 commit d462cd1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/chain_indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package core

import (
"context"
"errors"
"fmt"
"math/big"
"math/rand"
Expand Down Expand Up @@ -224,7 +225,10 @@ func (b *testChainIndexBackend) Process(ctx context.Context, header *types.Heade
//t.processCh <- header.Number.Uint64()
select {
case <-time.After(10 * time.Second):
b.t.Fatal("Unexpected call to Process")
b.t.Error("Unexpected call to Process")
// Can't use Fatal since this is not the test's goroutine.
// Returning error stops the chainIndexer's updateLoop
return errors.New("Unexpected call to Process")
case b.processCh <- header.Number.Uint64():
}
return nil
Expand Down

0 comments on commit d462cd1

Please sign in to comment.