This commit is contained in:
tycho garen
2021-06-14 08:18:53 -04:00
parent f8458a19d4
commit 3e30543246
3 changed files with 29 additions and 5 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ func makeNode(config *cfg.Config,
}
// Determine whether we should attempt state sync.
stateSync := config.StateSync.Enable && !onlyValidatorIsUs(state, pubKey)
stateSync := config.StateSync.Enable && !onlyValidatorIsUs(genDoc, pubKey)
if stateSync && state.LastBlockHeight > 0 {
logger.Info("Found local state with non-zero height, skipping state sync")
stateSync = false
+4 -4
View File
@@ -182,12 +182,12 @@ func logNodeStartupInfo(state sm.State, pubKey crypto.PubKey, logger, consensusL
}
}
func onlyValidatorIsUs(state sm.State, pubKey crypto.PubKey) bool {
if state.Validators.Size() > 1 {
func onlyValidatorIsUs(genDoc *types.GenesisDoc, pubKey crypto.PubKey) bool {
if len(genDoc.Validators) > 1 || pubKey == nil {
return false
}
addr, _ := state.Validators.GetByIndex(0)
return pubKey != nil && bytes.Equal(pubKey.Address(), addr)
return bytes.Equal(pubKey.Address(), genDoc.Validators[0].Address)
}
func createMempoolReactor(