Use go-crypto's CRand*
This commit is contained in:
parent
18d0da4ea3
commit
81ba1e6177
|
@ -80,7 +80,7 @@ func (privVal *PrivValidator) SetSigner(s Signer) {
|
||||||
// Generates a new validator with private key.
|
// Generates a new validator with private key.
|
||||||
func GenPrivValidator() *PrivValidator {
|
func GenPrivValidator() *PrivValidator {
|
||||||
privKeyBytes := new([64]byte)
|
privKeyBytes := new([64]byte)
|
||||||
copy(privKeyBytes[:32], CRandBytes(32))
|
copy(privKeyBytes[:32], crypto.CRandBytes(32))
|
||||||
pubKeyBytes := ed25519.MakePublicKey(privKeyBytes)
|
pubKeyBytes := ed25519.MakePublicKey(privKeyBytes)
|
||||||
pubKey := crypto.PubKeyEd25519(*pubKeyBytes)
|
pubKey := crypto.PubKeyEd25519(*pubKeyBytes)
|
||||||
privKey := crypto.PrivKeyEd25519(*privKeyBytes)
|
privKey := crypto.PrivKeyEd25519(*privKeyBytes)
|
||||||
|
|
|
@ -133,9 +133,9 @@ func Test2_3MajorityRedux(t *testing.T) {
|
||||||
height, round := 1, 0
|
height, round := 1, 0
|
||||||
voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 100, 1)
|
voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 100, 1)
|
||||||
|
|
||||||
blockHash := CRandBytes(32)
|
blockHash := crypto.CRandBytes(32)
|
||||||
blockPartsTotal := 123
|
blockPartsTotal := 123
|
||||||
blockPartsHeader := PartSetHeader{blockPartsTotal, CRandBytes(32)}
|
blockPartsHeader := PartSetHeader{blockPartsTotal, crypto.CRandBytes(32)}
|
||||||
|
|
||||||
vote := &Vote{Height: height, Round: round, Type: VoteTypePrevote, BlockHash: blockHash, BlockPartsHeader: blockPartsHeader}
|
vote := &Vote{Height: height, Round: round, Type: VoteTypePrevote, BlockHash: blockHash, BlockPartsHeader: blockPartsHeader}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ func Test2_3MajorityRedux(t *testing.T) {
|
||||||
|
|
||||||
// 68th validator voted for a different BlockParts PartSetHeader
|
// 68th validator voted for a different BlockParts PartSetHeader
|
||||||
{
|
{
|
||||||
blockPartsHeader := PartSetHeader{blockPartsTotal, CRandBytes(32)}
|
blockPartsHeader := PartSetHeader{blockPartsTotal, crypto.CRandBytes(32)}
|
||||||
signAddVote(privValidators[67], withBlockPartsHeader(vote, blockPartsHeader), voteSet)
|
signAddVote(privValidators[67], withBlockPartsHeader(vote, blockPartsHeader), voteSet)
|
||||||
hash, header, ok = voteSet.TwoThirdsMajority()
|
hash, header, ok = voteSet.TwoThirdsMajority()
|
||||||
if hash != nil || !header.IsZero() || ok {
|
if hash != nil || !header.IsZero() || ok {
|
||||||
|
@ -235,7 +235,7 @@ func TestBadVotes(t *testing.T) {
|
||||||
func TestMakeValidation(t *testing.T) {
|
func TestMakeValidation(t *testing.T) {
|
||||||
height, round := 1, 0
|
height, round := 1, 0
|
||||||
voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrecommit, 10, 1)
|
voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrecommit, 10, 1)
|
||||||
blockHash, blockPartsHeader := CRandBytes(32), PartSetHeader{123, CRandBytes(32)}
|
blockHash, blockPartsHeader := crypto.CRandBytes(32), PartSetHeader{123, crypto.CRandBytes(32)}
|
||||||
|
|
||||||
vote := &Vote{Height: height, Round: round, Type: VoteTypePrecommit,
|
vote := &Vote{Height: height, Round: round, Type: VoteTypePrecommit,
|
||||||
BlockHash: blockHash, BlockPartsHeader: blockPartsHeader}
|
BlockHash: blockHash, BlockPartsHeader: blockPartsHeader}
|
||||||
|
|
Loading…
Reference in New Issue