mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-20 15:02:33 +00:00
hacking
This commit is contained in:
@@ -46,3 +46,27 @@ func (gs *groupImpl) OnReset() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type FunctionalService struct {
|
||||
Starter func() error
|
||||
Stopper func()
|
||||
Reseter func() error
|
||||
}
|
||||
|
||||
func MakeFunctionalService(logger log.Logger, name string, opts FunctionalService) Service {
|
||||
srv := &funImpl{
|
||||
opts: FunctionalService,
|
||||
}
|
||||
|
||||
srv.BaseService = NewBaseService(logger, name, srv)
|
||||
return srv
|
||||
}
|
||||
|
||||
type funImpl struct {
|
||||
*BaseService
|
||||
ops FunctionalService
|
||||
}
|
||||
|
||||
func (fs *funImpl) OnStart() error { return fs.ops.Starter() }
|
||||
func (fs *funImpl) OnStop() { fs.ops.Stoper() }
|
||||
func (fs *funImpl) OnReset() error { return fs.ops.Reseter() }
|
||||
|
||||
+1
-1
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user