diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 7aa2b5d81..c09efa0c7 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -898,7 +898,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 3fd8347e5..6f3be2c51 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -277,15 +277,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") + } } }