Skip to content

Commit 8f69b5c

Browse files
committed
Added invalid sec key test
1 parent d2a4bc4 commit 8f69b5c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crypto/secp256k1/secp256_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package secp256k1
33
import (
44
"bytes"
55
"fmt"
6-
"github.com/ethereum/go-ethereum/crypto/randentropy"
76
"log"
87
"testing"
8+
9+
"github.com/ethereum/go-ethereum/crypto/randentropy"
910
)
1011

1112
const TESTS = 10000 // how many tests
@@ -227,3 +228,11 @@ func Test_Secp256_06b(t *testing.T) {
227228
fmt.Printf("ERROR: Accepted signature for %v of %v random messages\n", fail_count, TESTS)
228229
}
229230
}
231+
232+
func TestInvalidKey(t *testing.T) {
233+
p1 := make([]byte, 32)
234+
err := VerifySeckeyValidity(p1)
235+
if err == nil {
236+
t.Errorf("pvk %x varify sec key should have returned error", p1)
237+
}
238+
}

0 commit comments

Comments
 (0)