mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 04:41:22 +00:00
consensus: fixes #1754
* updateToState exits early if the state isn't new, which happens after * fast syncing. This results in not sending a NewRoundStep message. The mempool * reactor depends on PeerState, which is updated by NewRoundStep * messages. If the peer never sends a NewRoundStep, the mempool reactor * will think they're behind, and never forward transactions. Note this * only happens when `create_empty_blocks = false`, because otherwise * peers will move through the consensus state and send a NewRoundStep * for a new step soon anyways. Simple fix is just to send the * NewRoundStep message during updateToState even if exit early
This commit is contained in:
@ -460,9 +460,12 @@ func (cs *ConsensusState) updateToState(state sm.State) {
|
||||
|
||||
// If state isn't further out than cs.state, just ignore.
|
||||
// This happens when SwitchToConsensus() is called in the reactor.
|
||||
// We don't want to reset e.g. the Votes.
|
||||
// We don't want to reset e.g. the Votes, but we still want to
|
||||
// signal the new round step, because other services (eg. mempool)
|
||||
// depend on having an up-to-date peer state!
|
||||
if !cs.state.IsEmpty() && (state.LastBlockHeight <= cs.state.LastBlockHeight) {
|
||||
cs.Logger.Info("Ignoring updateToState()", "newHeight", state.LastBlockHeight+1, "oldHeight", cs.state.LastBlockHeight+1)
|
||||
cs.newStep()
|
||||
return
|
||||
}
|
||||
|
||||
@ -492,6 +495,7 @@ func (cs *ConsensusState) updateToState(state sm.State) {
|
||||
} else {
|
||||
cs.StartTime = cs.config.Commit(cs.CommitTime)
|
||||
}
|
||||
|
||||
cs.Validators = validators
|
||||
cs.Proposal = nil
|
||||
cs.ProposalBlock = nil
|
||||
@ -517,7 +521,7 @@ func (cs *ConsensusState) newStep() {
|
||||
rs := cs.RoundStateEvent()
|
||||
cs.wal.Write(rs)
|
||||
cs.nSteps++
|
||||
// newStep is called by updateToStep in NewConsensusState before the eventBus is set!
|
||||
// newStep is called by updateToState in NewConsensusState before the eventBus is set!
|
||||
if cs.eventBus != nil {
|
||||
cs.eventBus.PublishEventNewRoundStep(rs)
|
||||
cs.evsw.FireEvent(types.EventNewRoundStep, &cs.RoundState)
|
||||
|
Reference in New Issue
Block a user