From ec3e8baeea2f7ac57f93dc157ef376b26341bc44 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 3 Jun 2022 16:59:47 -0400 Subject: [PATCH] additional fixes --- internal/consensus/state.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index ea42b2706..29a42b873 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -519,10 +519,11 @@ func (cs *State) getOnStopCh() chan *cstypes.RoundState { func (cs *State) OnStop() { // If the node is committing a new block, wait until it is finished! if cs.GetRoundState().Step == cstypes.RoundStepCommit { + ct := time.Until(cs.commitTime(time.Now())) select { case <-cs.getOnStopCh(): - case <-time.After(cs.state.ConsensusParams.Timeout.Commit): - cs.logger.Error("OnStop: timeout waiting for commit to finish", "time", cs.state.ConsensusParams.Timeout.Commit) + case <-time.After(ct): + cs.logger.Error("OnStop: timeout waiting for commit to finish", "time", ct) } } @@ -1389,7 +1390,7 @@ func (cs *State) defaultDecideProposal(ctx context.Context, height int64, round p := proposal.ToProto() // wait the max amount we would wait for a proposal - ctxto, cancel := context.WithTimeout(ctx, cs.state.ConsensusParams.Timeout.Propose) + ctxto, cancel := context.WithTimeout(ctx, cs.proposeTimeout(round)) defer cancel() if err := cs.privValidator.SignProposal(ctxto, cs.state.ChainID, p); err == nil { proposal.Signature = p.Signature