diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index eb5949a70..550c60b2b 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -685,6 +685,7 @@ func ensureProposal(t *testing.T, proposalCh <-chan tmpubsub.Message, height int ensureProposalWithTimeout(t, proposalCh, height, round, propID, ensureTimeout) } +// nolint: lll func ensureProposalWithTimeout(t *testing.T, proposalCh <-chan tmpubsub.Message, height int64, round int32, propID types.BlockID, timeout time.Duration) { t.Helper() msg := ensureMessageBeforeTimeout(t, proposalCh, timeout) diff --git a/internal/consensus/pbts_test.go b/internal/consensus/pbts_test.go index 434640226..3b9b2fb46 100644 --- a/internal/consensus/pbts_test.go +++ b/internal/consensus/pbts_test.go @@ -149,7 +149,9 @@ func (p *pbtsTestHarness) observedValidatorProposerHeight(previousBlockTime time ensureNewRound(p.t, p.roundCh, p.currentHeight, p.currentRound) propBlock, partSet := p.observedState.createProposalBlock() bid := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: partSet.Header()} - ensureProposalWithTimeout(p.t, p.ensureProposalCh, p.currentHeight, p.currentRound, bid, previousBlockTime.Add(ensureTimeout).Sub(time.Now())) + + timeout := time.Until(previousBlockTime.Add(ensureTimeout)) + ensureProposalWithTimeout(p.t, p.ensureProposalCh, p.currentHeight, p.currentRound, bid, timeout) ensurePrevote(p.t, p.ensureVoteCh, p.currentHeight, p.currentRound) signAddVotes(p.ctx, p.observedState, tmproto.PrevoteType, p.chainID, bid, p.otherValidators...) @@ -169,7 +171,8 @@ func (p *pbtsTestHarness) observedValidatorProposerHeight(previousBlockTime time func (p *pbtsTestHarness) height2() heightResult { signer := p.otherValidators[0].PrivValidator - return p.nextHeight(signer, p.height2ProposalDeliverTime, p.height2ProposedBlockTime, p.height4ProposedBlockTime.Add(-blockTimeIota)) + height3BlockTime := p.height2ProposedBlockTime.Add(-blockTimeIota) + return p.nextHeight(signer, p.height2ProposalDeliverTime, p.height2ProposedBlockTime, height3BlockTime) } func (p *pbtsTestHarness) intermediateHeights() { @@ -291,12 +294,13 @@ type timestampedEvent struct { func (p *pbtsTestHarness) run() resultSet { startTestRound(p.ctx, p.observedState, p.currentHeight, p.currentRound) - defer p.observedState.Stop() r1 := p.observedValidatorProposerHeight(p.genesisTime) r2 := p.height2() p.intermediateHeights() r5 := p.height5() + err := p.observedState.Stop() + require.NoError(p.t, err) return resultSet{ genesisHeight: r1, height2: r2,