Browse Source

Use go-crypto's CRand*

pull/206/merge
Jae Kwon 8 years ago
parent
commit
81ba1e6177
2 changed files with 5 additions and 5 deletions
  1. +1
    -1
      types/priv_validator.go
  2. +4
    -4
      types/vote_set_test.go

+ 1
- 1
types/priv_validator.go 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)


+ 4
- 4
types/vote_set_test.go 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}


Loading…
Cancel
Save