[dpos] work-around for genesis info compatibility
@@ -52,7 +52,7 @@ type bpInfo struct {
// New returns a new DPos object
func New(cfg *config.Config, cdb consensus.ChainDbReader, hub *component.ComponentHub) (consensus.Consensus, error) {
genesis := cdb.GetGenesisInfo()
-
+ if genesis != nil {
logger.Debug().Str("genesis", spew.Sdump(genesis)).Msg("genesis info loaded")
bpCount := len(genesis.BPs)
// Prefer BPs from the GenesisInfo. Overwrite.
@@ -61,6 +61,7 @@ func New(cfg *config.Config, cdb consensus.ChainDbReader, hub *component.Compone
cfg.Consensus.BpIds = genesis.BPs
cfg.Consensus.DposBpNumber = uint16(bpCount)
}
+ }
Init(cfg.Consensus)
