You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
696 B

  1. package factory
  2. import (
  3. "time"
  4. cfg "github.com/tendermint/tendermint/config"
  5. "github.com/tendermint/tendermint/types"
  6. )
  7. func GenesisDoc(
  8. config *cfg.Config,
  9. time time.Time,
  10. validators []*types.Validator,
  11. consensusParams *types.ConsensusParams,
  12. ) *types.GenesisDoc {
  13. genesisValidators := make([]types.GenesisValidator, len(validators))
  14. for i := range validators {
  15. genesisValidators[i] = types.GenesisValidator{
  16. Power: validators[i].VotingPower,
  17. PubKey: validators[i].PubKey,
  18. }
  19. }
  20. return &types.GenesisDoc{
  21. GenesisTime: time,
  22. InitialHeight: 1,
  23. ChainID: config.ChainID(),
  24. Validators: genesisValidators,
  25. ConsensusParams: consensusParams,
  26. }
  27. }