Explorar o código

Added invalid sec key test

obscuren %!s(int64=10) %!d(string=hai) anos
pai
achega
8f69b5c7a2
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      crypto/secp256k1/secp256_test.go

+ 10 - 1
crypto/secp256k1/secp256_test.go

@@ -3,9 +3,10 @@ package secp256k1
 import (
 	"bytes"
 	"fmt"
-	"github.com/ethereum/go-ethereum/crypto/randentropy"
 	"log"
 	"testing"
+
+	"github.com/ethereum/go-ethereum/crypto/randentropy"
 )
 
 const TESTS = 10000 // how many tests
@@ -227,3 +228,11 @@ func Test_Secp256_06b(t *testing.T) {
 		fmt.Printf("ERROR: Accepted signature for %v of %v random messages\n", fail_count, TESTS)
 	}
 }
+
+func TestInvalidKey(t *testing.T) {
+	p1 := make([]byte, 32)
+	err := VerifySeckeyValidity(p1)
+	if err == nil {
+		t.Errorf("pvk %x varify sec key should have returned error", p1)
+	}
+}