Browse Source

Merge pull request #611 from tendermint/dont_panic

Dont panic
pull/623/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
56b959b9f9
2 changed files with 11 additions and 2 deletions
  1. +5
    -2
      consensus/reactor.go
  2. +6
    -0
      consensus/state.go

+ 5
- 2
consensus/reactor.go View File

@ -918,7 +918,7 @@ func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote
func (ps *PeerState) getVoteBitArray(height, round int, type_ byte) *cmn.BitArray {
if !types.IsVoteTypeValid(type_) {
cmn.PanicSanity("Invalid vote type")
return nil
}
if ps.Height == height {
@ -1029,7 +1029,10 @@ func (ps *PeerState) setHasVote(height int, round int, type_ byte, index int) {
logger.Debug("setHasVote(LastCommit)", "lastCommit", ps.LastCommit, "index", index)
// NOTE: some may be nil BitArrays -> no side effects.
ps.getVoteBitArray(height, round, type_).SetIndex(index, true)
psVotes := ps.getVoteBitArray(height, round, type_)
if psVotes != nil {
psVotes.SetIndex(index, true)
}
}
// ApplyNewRoundStepMessage updates the peer state for the new round.


+ 6
- 0
consensus/state.go View File

@ -615,6 +615,12 @@ func (cs *ConsensusState) newStep() {
// Updates (state transitions) happen on timeouts, complete proposals, and 2/3 majorities.
// ConsensusState must be locked before any internal state is updated.
func (cs *ConsensusState) receiveRoutine(maxSteps int) {
defer func() {
if r := recover(); r != nil {
cs.Logger.Error("CONSENSUS FAILURE!!!", "err", r)
}
}()
for {
if maxSteps > 0 {
if cs.nSteps >= maxSteps {


Loading…
Cancel
Save