Skip to content

Commit

Permalink
Merge PR: avc when proposer in waiting (#2880)
Browse files Browse the repository at this point in the history
Co-authored-by: xiangjianmeng <[email protected]>
  • Loading branch information
chengzhinei and xiangjianmeng authored Dec 29, 2022
1 parent 7934307 commit da54c47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions libs/tendermint/consensus/consensus_propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,20 @@ func (cs *State) enterPropose(height int64, round int) {

cs.initNewHeight()
isBlockProducer, bpAddr := cs.isBlockProducer()

cs.stateMtx.RLock()
cs.updateRoundStep(round, cstypes.RoundStepPropose)
newProposer := ""
if cs.vcHeight[height] != "" {
newProposer = "-avc-" + cs.vcHeight[height][:6]
}
cs.stateMtx.RUnlock()
cs.trc.Pin("enterPropose-%d-%s-%s%s", round, isBlockProducer, bpAddr, newProposer)

logger.Info(fmt.Sprintf("enterPropose(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step))

defer func() {
// Done enterPropose:
cs.updateRoundStep(round, cstypes.RoundStepPropose)
cs.newStep()

// If we have the whole proposal + POL, then goto Prevote now.
Expand All @@ -124,7 +127,7 @@ func (cs *State) enterPropose(height int64, round int) {
bpAddr,
"privValidator",
cs.privValidator)
if cs.vcHeight[height] == "" || cs.Round != 0 {
if newProposer == "" || cs.Round != 0 {
cs.decideProposal(height, round)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion libs/tendermint/consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
// or prMsg.height != prMsg.proposal.Height
if msg.Height <= conR.hasViewChanged ||
!bytes.Equal(conR.conS.privValidatorPubKey.Address(), msg.CurrentProposer) ||
msg.Height <= height ||
msg.Height < height || (msg.Height == height && conR.conS.Step != cstypes.RoundStepNewHeight) ||
msg.Height != msg.Proposal.Height {
return
}
Expand Down

0 comments on commit da54c47

Please sign in to comment.