mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-21 06:36:19 +00:00
consensus: remove panics from test helper functions (#6969)
This commit is contained in:
@@ -368,6 +368,7 @@ func validatePrevoteAndPrecommit(
|
||||
votedBlockHash,
|
||||
lockedBlockHash []byte,
|
||||
) {
|
||||
t.Helper()
|
||||
// verify the prevote
|
||||
validatePrevote(ctx, t, cs, thisRound, privVal, votedBlockHash)
|
||||
// verify precommit
|
||||
@@ -739,6 +740,7 @@ func randConsensusState(
|
||||
appFunc func(t *testing.T, logger log.Logger) abci.Application,
|
||||
configOpts ...func(*config.Config),
|
||||
) ([]*State, cleanupFunc) {
|
||||
t.Helper()
|
||||
|
||||
genDoc, privVals := factory.RandGenesisDoc(ctx, t, cfg, nValidators, false, 30)
|
||||
css := make([]*State, nValidators)
|
||||
@@ -802,6 +804,7 @@ func randConsensusNetWithPeers(
|
||||
|
||||
genDoc, privVals := factory.RandGenesisDoc(ctx, t, cfg, nValidators, false, testMinPower)
|
||||
css := make([]*State, nPeers)
|
||||
t.Helper()
|
||||
logger := consensusLogger()
|
||||
|
||||
var peer0Config *config.Config
|
||||
|
||||
@@ -1846,7 +1846,7 @@ func TestStateSlashingPrevotes(t *testing.T) {
|
||||
voteCh := subscribeToVoter(ctx, t, cs1, cs1.privValidator.GetAddress())
|
||||
|
||||
// start round and wait for propose and prevote
|
||||
startTestRound(cs1, cs1.Height, 0)
|
||||
startTestRound(ctx, cs1, cs1.Height, 0)
|
||||
<-newRoundCh
|
||||
re := <-proposalCh
|
||||
<-voteCh // prevote
|
||||
@@ -1881,7 +1881,7 @@ func TestStateSlashingPrecommits(t *testing.T) {
|
||||
voteCh := subscribeToVoter(ctx, t, cs1, cs1.privValidator.GetAddress())
|
||||
|
||||
// start round and wait for propose and prevote
|
||||
startTestRound(cs1, cs1.Height, 0)
|
||||
startTestRound(ctx, cs1, cs1.Height, 0)
|
||||
<-newRoundCh
|
||||
re := <-proposalCh
|
||||
<-voteCh // prevote
|
||||
|
||||
Reference in New Issue
Block a user