Add comments for test and improve bls test

pull/339/head
Rongjian Lan 6 years ago
parent 456002406c
commit 97a04231df
  1. 1
      crypto/bls/bls_test.go
  2. 7
      internal/utils/utils_test.go

@ -7,6 +7,7 @@ import (
"github.com/harmony-one/harmony/internal/utils"
)
// Test the basic functionality of a BLS multi-sig mask.
func TestNewMask(test *testing.T) {
_, pubKey1 := utils.GenKeyBLS("127.0.0.1", "5555")
_, pubKey2 := utils.GenKeyBLS("127.0.0.1", "6666")

@ -1,6 +1,8 @@
package utils
import (
"bytes"
"encoding/hex"
"testing"
"github.com/harmony-one/harmony/p2p"
@ -54,6 +56,11 @@ func TestGenKeyBLS(t *testing.T) {
if priKey == nil || pubKey == nil {
t.Error("Failed to create keys for BLS sig")
}
pubKeyBytes, _ := hex.DecodeString("ca6247713431a59cbadfe282b36cb13746b6e5c5db6e5972a10a83adffdf23f8aab246229cb3050e061e1024aa9b6518e200dd9663a8c855e596f1007150aa0672e6f40d073947aa027e8ffe8e89d894ca3916f80fdb350f4b8643f6ff99510c")
if bytes.Compare(pubKey.Serialize(), pubKeyBytes) != 0 {
t.Errorf("Unexpected public key: %s", hex.EncodeToString(pubKey.Serialize()))
}
}
// Test for GenKeyP2P, noted the length of private key can be random

Loading…
Cancel
Save