Use go-crypto's CRand*

This commit is contained in:
Jae Kwon 2016-03-13 10:01:32 -07:00
parent 18d0da4ea3
commit 81ba1e6177
2 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ func (privVal *PrivValidator) SetSigner(s Signer) {
// Generates a new validator with private key.
func GenPrivValidator() *PrivValidator {
privKeyBytes := new([64]byte)
copy(privKeyBytes[:32], CRandBytes(32))
copy(privKeyBytes[:32], crypto.CRandBytes(32))
pubKeyBytes := ed25519.MakePublicKey(privKeyBytes)
pubKey := crypto.PubKeyEd25519(*pubKeyBytes)
privKey := crypto.PrivKeyEd25519(*privKeyBytes)

View File

@ -133,9 +133,9 @@ func Test2_3MajorityRedux(t *testing.T) {
height, round := 1, 0
voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 100, 1)
blockHash := CRandBytes(32)
blockHash := crypto.CRandBytes(32)
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}
@ -159,7 +159,7 @@ func Test2_3MajorityRedux(t *testing.T) {
// 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)
hash, header, ok = voteSet.TwoThirdsMajority()
if hash != nil || !header.IsZero() || ok {
@ -235,7 +235,7 @@ func TestBadVotes(t *testing.T) {
func TestMakeValidation(t *testing.T) {
height, round := 1, 0
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,
BlockHash: blockHash, BlockPartsHeader: blockPartsHeader}