Merge pull request #1694 from chaosma/s3

fix initial leader bootstrap issue
pull/1719/head v1-20191001.1
chaosma 5 years ago committed by GitHub
commit f112794d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      consensus/consensus_v2.go

@ -1027,7 +1027,8 @@ func (consensus *Consensus) tryCatchup() {
func (consensus *Consensus) Start(blockChannel chan *types.Block, stopChan chan struct{}, stoppedChan chan struct{}, startChannel chan struct{}) {
go func() {
toStart := false
if consensus.IsLeader() {
isInitialLeader := consensus.IsLeader()
if isInitialLeader {
utils.Logger().Info().Time("time", time.Now()).Msg("[ConsensusMainLoop] Waiting for consensus start")
// send a signal to indicate it's ready to run consensus
@ -1052,7 +1053,7 @@ func (consensus *Consensus) Start(blockChannel chan *types.Block, stopChan chan
for {
select {
case <-ticker.C:
if toStart == false {
if toStart == false && isInitialLeader {
continue
}
for k, v := range consensus.consensusTimeout {

Loading…
Cancel
Save