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.

28 lines
879 B

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. package consensus
  2. import (
  3. "github.com/tendermint/tendermint/state"
  4. )
  5. // Common test methods
  6. func makeValidator(id uint64, votingPower uint64) (*state.Validator, *state.PrivAccount) {
  7. privAccount := state.GenPrivAccount()
  8. privAccount.Id = id
  9. return &state.Validator{
  10. Account: privAccount.Account,
  11. VotingPower: votingPower,
  12. }, privAccount
  13. }
  14. func makeVoteSet(height uint32, round uint16, type_ byte, numValidators int, votingPower uint64) (*VoteSet, *state.ValidatorSet, []*state.PrivAccount) {
  15. vals := make([]*state.Validator, numValidators)
  16. privAccounts := make([]*state.PrivAccount, numValidators)
  17. for i := 0; i < numValidators; i++ {
  18. val, privAccount := makeValidator(uint64(i), votingPower)
  19. vals[i] = val
  20. privAccounts[i] = privAccount
  21. }
  22. valSet := state.NewValidatorSet(vals)
  23. return NewVoteSet(height, round, type_, valSet), valSet, privAccounts
  24. }