mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 05:41:21 +00:00
POL tests
This commit is contained in:
27
consensus/test.go
Normal file
27
consensus/test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package consensus
|
||||
|
||||
import (
|
||||
. "github.com/tendermint/tendermint/blocks"
|
||||
"github.com/tendermint/tendermint/state"
|
||||
)
|
||||
|
||||
func makeValidator(id uint64, votingPower uint64) (*state.Validator, *state.PrivAccount) {
|
||||
privAccount := state.GenPrivAccount()
|
||||
privAccount.Id = id
|
||||
return &state.Validator{
|
||||
Account: privAccount.Account,
|
||||
VotingPower: votingPower,
|
||||
}, privAccount
|
||||
}
|
||||
|
||||
func makeVoteSet(height uint32, round uint16, numValidators int, votingPower uint64) (*VoteSet, *state.ValidatorSet, []*state.PrivAccount) {
|
||||
vals := make([]*state.Validator, numValidators)
|
||||
privAccounts := make([]*state.PrivAccount, numValidators)
|
||||
for i := 0; i < numValidators; i++ {
|
||||
val, privAccount := makeValidator(uint64(i), votingPower)
|
||||
vals[i] = val
|
||||
privAccounts[i] = privAccount
|
||||
}
|
||||
valSet := state.NewValidatorSet(vals)
|
||||
return NewVoteSet(height, round, VoteTypeBare, valSet), valSet, privAccounts
|
||||
}
|
Reference in New Issue
Block a user