diff --git a/genesis/genesis.go b/genesis/genesis.go index 4be991501..3d6cdac32 100644 --- a/genesis/genesis.go +++ b/genesis/genesis.go @@ -56,7 +56,7 @@ type Genesis struct { type genesisData struct { GenesisTime time.Time `cbor:"1,keyasint" json:"genesis_time"` - Params *GenParams `cbor:"2,keyasint" json:"params"` + Params *genParams `cbor:"2,keyasint" json:"params"` Accounts []genAccount `cbor:"3,keyasint" json:"accounts"` Validators []genValidator `cbor:"4,keyasint" json:"validators"` } @@ -71,7 +71,7 @@ func (gen *Genesis) GenesisTime() time.Time { return gen.data.GenesisTime } -func (gen *Genesis) Params() *GenParams { +func (gen *Genesis) Params() *genParams { return gen.data.Params } @@ -123,7 +123,7 @@ func makeGenesisValidator(val *validator.Validator) genValidator { } func MakeGenesis(genesisTime time.Time, accounts map[crypto.Address]*account.Account, - validators []*validator.Validator, params *GenParams, + validators []*validator.Validator, params *genParams, ) *Genesis { genAccs := make([]genAccount, len(accounts)) for addr, acc := range accounts { diff --git a/genesis/genesis_param.go b/genesis/genesis_param.go index 620038f10..1ccd64203 100644 --- a/genesis/genesis_param.go +++ b/genesis/genesis_param.go @@ -6,7 +6,7 @@ import ( "github.com/pactus-project/pactus/types/amount" ) -type GenParams struct { +type genParams struct { BlockVersion uint8 `cbor:"1,keyasint" json:"block_version"` BlockIntervalInSecond int `cbor:"2,keyasint" json:"block_interval_in_second"` CommitteeSize int `cbor:"3,keyasint" json:"committee_size"` @@ -22,8 +22,8 @@ type GenParams struct { MaximumStake amount.Amount `cbor:"13,keyasint" json:"maximum_stake"` } -func DefaultGenParams() *GenParams { - return &GenParams{ +func DefaultGenParams() *genParams { + return &genParams{ BlockVersion: 1, BlockIntervalInSecond: 10, CommitteeSize: 51, @@ -40,6 +40,6 @@ func DefaultGenParams() *GenParams { } } -func (p *GenParams) BlockInterval() time.Duration { +func (p *genParams) BlockInterval() time.Duration { return time.Duration(p.BlockIntervalInSecond) * time.Second }