diff --git a/block/manager.go b/block/manager.go index baec63d82..0d3eba315 100644 --- a/block/manager.go +++ b/block/manager.go @@ -133,7 +133,6 @@ func NewManager( return nil, err } validators = append(validators, tmtypes.NewValidator(tmPubKey, 1)) - } res, err := exec.InitChain(genesis, validators) @@ -817,6 +816,11 @@ func updateInitChainState(s *types.State, res *abci.ResponseInitChain, validator copy(s.AppHash[:], res.AppHash) } + //The validators after initChain must be greater than zero, otherwise this state is not loadable + if len(validators) <= 0 { + panic("Validators must be greater than zero") + } + if res.ConsensusParams != nil { params := res.ConsensusParams if params.Block != nil { @@ -841,8 +845,8 @@ func updateInitChainState(s *types.State, res *abci.ResponseInitChain, validator // We update the last results hash with the empty hash, to conform with RFC-6962. copy(s.LastResultsHash[:], merkle.HashFromByteSlices(nil)) - if len(validators) > 0 { - s.Validators = tmtypes.NewValidatorSet(validators) - s.NextValidators = tmtypes.NewValidatorSet(validators).CopyIncrementProposerPriority(1) - } + // Set the validators in the state + s.Validators = tmtypes.NewValidatorSet(validators).CopyIncrementProposerPriority(1) + s.NextValidators = s.Validators.Copy() + s.LastValidators = s.Validators.Copy() } diff --git a/config/defaults.go b/config/defaults.go index 3ccc45bc4..d29d2b8d0 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -29,8 +29,8 @@ func DefaultConfig(home, chainId string) *NodeConfig { Aggregator: true, BlockManagerConfig: BlockManagerConfig{ BlockTime: 200 * time.Millisecond, - EmptyBlocksMaxTime: 60 * time.Second, - BatchSubmitMaxTime: 600 * time.Second, + EmptyBlocksMaxTime: 3 * time.Second, + BatchSubmitMaxTime: 30 * time.Second, NamespaceID: "000000000000ffff", BlockBatchSize: 500, BlockBatchMaxSizeBytes: 1500000},