mirror of https://github.com/poanetwork/quorum.git
Moving setting the consensus in the start instead of when getting a new backend
This commit is contained in:
parent
89fac8995a
commit
c728a9694f
|
@ -62,11 +62,7 @@ func New(config *istanbul.Config, privateKey *ecdsa.PrivateKey, db ethdb.Databas
|
|||
recentMessages: recentMessages,
|
||||
knownMessages: knownMessages,
|
||||
}
|
||||
if backend.IsQIBFTConsensus() {
|
||||
backend.core = qibftCore.New(backend, backend.config)
|
||||
} else {
|
||||
backend.core = istanbulCore.New(backend, backend.config)
|
||||
}
|
||||
|
||||
return backend
|
||||
}
|
||||
|
||||
|
@ -332,7 +328,7 @@ func (sb *backend) IsQIBFTConsensus() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if sb.qibftConsensusEnabled || sb.config.QibftBlock.Uint64() == 0{
|
||||
if sb.qibftConsensusEnabled || sb.config.QibftBlock.Uint64() == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/istanbul"
|
||||
istanbulCore "github.com/ethereum/go-ethereum/consensus/istanbul/core"
|
||||
"github.com/ethereum/go-ethereum/consensus/istanbul/validator"
|
||||
qibftCore "github.com/ethereum/go-ethereum/consensus/qibft/core"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
|
@ -530,6 +531,13 @@ func (sb *backend) Start(chain consensus.ChainReader, currentBlock func() *types
|
|||
sb.currentBlock = currentBlock
|
||||
sb.hasBadBlock = hasBadBlock
|
||||
|
||||
// Check if qibft Consensus needs to be used after chain is set
|
||||
if sb.IsQIBFTConsensus() {
|
||||
sb.core = qibftCore.New(sb, sb.config)
|
||||
} else {
|
||||
sb.core = istanbulCore.New(sb, sb.config)
|
||||
}
|
||||
|
||||
if err := sb.core.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue