mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
ConsensusParams ptr in GenesisDoc for json
This commit is contained in:
parent
3089bbf2b8
commit
1f0985689d
@ -266,7 +266,7 @@ func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet) {
|
|||||||
func (s *State) Params() types.ConsensusParams {
|
func (s *State) Params() types.ConsensusParams {
|
||||||
// TODO: this should move into the State proper
|
// TODO: this should move into the State proper
|
||||||
// when we allow the app to change it
|
// when we allow the app to change it
|
||||||
return s.GenesisDoc.ConsensusParams
|
return *s.GenesisDoc.ConsensusParams
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
@ -26,7 +26,7 @@ type GenesisValidator struct {
|
|||||||
type GenesisDoc struct {
|
type GenesisDoc struct {
|
||||||
GenesisTime time.Time `json:"genesis_time"`
|
GenesisTime time.Time `json:"genesis_time"`
|
||||||
ChainID string `json:"chain_id"`
|
ChainID string `json:"chain_id"`
|
||||||
ConsensusParams ConsensusParams `json:"consensus_params"`
|
ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"`
|
||||||
Validators []GenesisValidator `json:"validators"`
|
Validators []GenesisValidator `json:"validators"`
|
||||||
AppHash data.Bytes `json:"app_hash"`
|
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")
|
return errors.Errorf("Genesis doc must include non-empty chain_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
var emptyParams ConsensusParams
|
if genDoc.ConsensusParams == nil {
|
||||||
if genDoc.ConsensusParams == emptyParams {
|
|
||||||
genDoc.ConsensusParams = DefaultConsensusParams()
|
genDoc.ConsensusParams = DefaultConsensusParams()
|
||||||
} else {
|
} else {
|
||||||
if err := genDoc.ConsensusParams.Validate(); err != nil {
|
if err := genDoc.ConsensusParams.Validate(); err != nil {
|
||||||
|
@ -35,8 +35,8 @@ type BlockGossipParams struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConsensusParams returns a default ConsensusParams.
|
// DefaultConsensusParams returns a default ConsensusParams.
|
||||||
func DefaultConsensusParams() ConsensusParams {
|
func DefaultConsensusParams() *ConsensusParams {
|
||||||
return ConsensusParams{
|
return &ConsensusParams{
|
||||||
DefaultBlockSizeParams(),
|
DefaultBlockSizeParams(),
|
||||||
DefaultTxSizeParams(),
|
DefaultTxSizeParams(),
|
||||||
DefaultBlockGossipParams(),
|
DefaultBlockGossipParams(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user