diff --git a/state/state.go b/state/state.go index 3a8b98d0..2ebbec10 100644 --- a/state/state.go +++ b/state/state.go @@ -266,7 +266,7 @@ func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet) { func (s *State) Params() types.ConsensusParams { // TODO: this should move into the State proper // when we allow the app to change it - return s.GenesisDoc.ConsensusParams + return *s.GenesisDoc.ConsensusParams } //------------------------------------------------------------------------ diff --git a/types/genesis.go b/types/genesis.go index e57787c4..f1b2736f 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -26,7 +26,7 @@ type GenesisValidator struct { type GenesisDoc struct { GenesisTime time.Time `json:"genesis_time"` ChainID string `json:"chain_id"` - ConsensusParams ConsensusParams `json:"consensus_params"` + ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"` Validators []GenesisValidator `json:"validators"` AppHash data.Bytes `json:"app_hash"` } @@ -58,8 +58,7 @@ func (genDoc *GenesisDoc) ValidateAndComplete() error { return errors.Errorf("Genesis doc must include non-empty chain_id") } - var emptyParams ConsensusParams - if genDoc.ConsensusParams == emptyParams { + if genDoc.ConsensusParams == nil { genDoc.ConsensusParams = DefaultConsensusParams() } else { if err := genDoc.ConsensusParams.Validate(); err != nil { diff --git a/types/params.go b/types/params.go index cd324219..495d1fd4 100644 --- a/types/params.go +++ b/types/params.go @@ -35,8 +35,8 @@ type BlockGossipParams struct { } // DefaultConsensusParams returns a default ConsensusParams. -func DefaultConsensusParams() ConsensusParams { - return ConsensusParams{ +func DefaultConsensusParams() *ConsensusParams { + return &ConsensusParams{ DefaultBlockSizeParams(), DefaultTxSizeParams(), DefaultBlockGossipParams(),