Merge branch 'main' into main

pull/3599/head
Rongjian Lan 4 years ago committed by GitHub
commit be159bf326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      consensus/consensus_service.go
  2. 21
      consensus/consensus_v2.go

@ -174,6 +174,9 @@ func (consensus *Consensus) IsValidatorInCommittee(pubKey bls.SerializedPublicKe
// SetMode sets the mode of consensus
func (consensus *Consensus) SetMode(m Mode) {
consensus.getLogger().Debug().
Str("Mode", m.String()).
Msg("[SetMode]")
consensus.current.SetMode(m)
}

@ -317,9 +317,26 @@ func (consensus *Consensus) Start(
continue
}
for k, v := range consensus.consensusTimeout {
if consensus.current.Mode() == Syncing ||
consensus.current.Mode() == Listening {
// stop timer in listening mode
if consensus.current.Mode() == Listening {
v.Stop()
continue
}
if consensus.current.Mode() == Syncing {
// never stop bootstrap timer here in syncing mode as it only starts once
// if it is stopped, bootstrap will be stopped and nodes
// can't start view change or join consensus
// the bootstrap timer will be stopped once consensus is reached or view change
// is succeeded
if k != timeoutBootstrap {
consensus.getLogger().Debug().
Str("k", k.String()).
Str("Mode", consensus.current.Mode().String()).
Msg("[ConsensusMainLoop] consensusTimeout stopped!!!")
v.Stop()
continue
}
}
if !v.CheckExpire() {
continue

Loading…
Cancel
Save