mirror of https://github.com/poanetwork/quorum.git
Legacy ibft should be used if qibftBlock is not defined in genesis
This commit is contained in:
parent
8044d33d40
commit
89fac8995a
|
@ -327,13 +327,15 @@ func (sb *backend) Close() error {
|
||||||
|
|
||||||
// IsQIBFTConsensus returns whether qbft consensus should be used
|
// IsQIBFTConsensus returns whether qbft consensus should be used
|
||||||
func (sb *backend) IsQIBFTConsensus() bool {
|
func (sb *backend) IsQIBFTConsensus() bool {
|
||||||
if sb.qibftConsensusEnabled {
|
// If qibftBlock is not defined in genesis, then use legacy ibft
|
||||||
return true
|
if sb.config.QibftBlock == nil {
|
||||||
}
|
return false
|
||||||
// If it is a new network then by default use qibft consensus
|
}
|
||||||
if sb.config.QibftBlock == nil || sb.config.QibftBlock.Uint64() == 0 {
|
|
||||||
|
if sb.qibftConsensusEnabled || sb.config.QibftBlock.Uint64() == 0{
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if sb.chain != nil && sb.chain.CurrentHeader().Number.Cmp(sb.config.QibftBlock) >= 0 {
|
if sb.chain != nil && sb.chain.CurrentHeader().Number.Cmp(sb.config.QibftBlock) >= 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,9 @@ func (c *core) Stop() error {
|
||||||
c.stopTimer()
|
c.stopTimer()
|
||||||
c.unsubscribeEvents()
|
c.unsubscribeEvents()
|
||||||
|
|
||||||
// Make sure the handler goroutine exits
|
// Not waiting for handlerWg to stop, as it was blocking legacy IBFT consensus to stop
|
||||||
c.handlerWg.Wait()
|
// and new events will be handled by qibft consensus
|
||||||
|
// c.handlerWg.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,11 +283,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
|
||||||
config.Istanbul.ProposerPolicy = istanbul.ProposerPolicy(chainConfig.Istanbul.ProposerPolicy)
|
config.Istanbul.ProposerPolicy = istanbul.ProposerPolicy(chainConfig.Istanbul.ProposerPolicy)
|
||||||
config.Istanbul.Ceil2Nby3Block = chainConfig.Istanbul.Ceil2Nby3Block
|
config.Istanbul.Ceil2Nby3Block = chainConfig.Istanbul.Ceil2Nby3Block
|
||||||
config.Istanbul.AllowedFutureBlockTime = config.AllowedFutureBlockTime
|
config.Istanbul.AllowedFutureBlockTime = config.AllowedFutureBlockTime
|
||||||
|
|
||||||
config.Istanbul.QibftBlock = chainConfig.Istanbul.QibftBlock
|
config.Istanbul.QibftBlock = chainConfig.Istanbul.QibftBlock
|
||||||
if chainConfig.Istanbul.QibftBlock == nil {
|
|
||||||
config.Istanbul.QibftBlock = big.NewInt(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
return istanbulBackend.New(&config.Istanbul, ctx.NodeKey(), db)
|
return istanbulBackend.New(&config.Istanbul, ctx.NodeKey(), db)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue