diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 6517ee639..12eaa0406 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -908,7 +908,7 @@ func randConsensusNetWithPeers( css[i] = newStateWithConfig(ctx, t, logger.With("validator", i, "module", "consensus"), thisConfig, state, privVal, app) css[i].SetTimeoutTicker(tickerFunc()) - require.NoError(t, css[i].Start(ctx)) + css[i].updateStateFromStore(ctx) } return css, genDoc, peer0Config, func() { for _, dir := range configRootDirs { diff --git a/internal/consensus/reactor_test.go b/internal/consensus/reactor_test.go index 773b20bde..970cc06df 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -276,15 +276,22 @@ func waitForAndValidateBlockWithTx( var wg sync.WaitGroup for i := 0; i < n; i++ { wg.Add(1) - go func(j int) { - defer wg.Done() - fn(j) - }(i) + go func(j int) { defer wg.Done(); fn(j) }(i) } + sig := make(chan struct{}) + go func() { defer close(sig); wg.Wait() }() - wg.Wait() - if err := ctx.Err(); errors.Is(err, context.DeadlineExceeded) { - t.Fatal("encountered timeout") + select { + case <-sig: + return + case <-ctx.Done(): + err := ctx.Err() + switch { + case errors.Is(err, context.DeadlineExceeded): + t.Fatal("encountered timeout") + case errors.Is(err, context.Canceled): + t.Fatal("operation aborted") + } } }