From c5cbbee86297f874eb83ffccfb6e88341bd90b7c Mon Sep 17 00:00:00 2001 From: ChihYunChuang Date: Thu, 2 Sep 2021 13:33:24 +0800 Subject: [PATCH] test2 --- crypto/commitment/hash_test.go | 2 +- crypto/ecpointgrouplaw/point.go | 5 ++++- crypto/ecpointgrouplaw/point_test.go | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crypto/commitment/hash_test.go b/crypto/commitment/hash_test.go index d7d3b22c..92a7f74b 100644 --- a/crypto/commitment/hash_test.go +++ b/crypto/commitment/hash_test.go @@ -157,7 +157,7 @@ var _ = Describe("hash", func() { Expect(got.Equal(p)).Should(BeTrue()) }) - It("failed to new by empty point", func() { + FIt("failed to new by empty point", func() { c, err := NewCommitterByPoint(&pt.ECPoint{}) Expect(err).ShouldNot(BeNil()) Expect(c).Should(BeNil()) diff --git a/crypto/ecpointgrouplaw/point.go b/crypto/ecpointgrouplaw/point.go index 7e362e2b..963deec1 100644 --- a/crypto/ecpointgrouplaw/point.go +++ b/crypto/ecpointgrouplaw/point.go @@ -242,6 +242,9 @@ func isIdentity(x *big.Int, y *big.Int) bool { } func isSameCurve(curve1 elliptic.Curve, curve2 elliptic.Curve) bool { + if curve1 == nil || curve2 == nil { + return false + } return reflect.DeepEqual(curve1.Params(), curve2.Params()) } @@ -283,7 +286,7 @@ func ToCurve(c elliptic.Curve) (EcPointMessage_Curve, error) { case btcec.S256(): return EcPointMessage_S256, nil } - // TODO: Rewrite it to be a switch case. + // TODO: Rewrite it to be a switch case. if isSameCurve(c, edwards.Edwards()) { return EcPointMessage_EDWARD25519, nil } diff --git a/crypto/ecpointgrouplaw/point_test.go b/crypto/ecpointgrouplaw/point_test.go index 3fcb5749..3ed3879f 100644 --- a/crypto/ecpointgrouplaw/point_test.go +++ b/crypto/ecpointgrouplaw/point_test.go @@ -456,8 +456,8 @@ var _ = Describe("Point", func() { Expect(gotP).Should(BeNil()) }) - It("ToPoint()", func() { - const UnSupportedEcPointMessage EcPointMessage_Curve = 4 + FIt("ToPoint()", func() { + const UnSupportedEcPointMessage EcPointMessage_Curve = 100 msg := &EcPointMessage{ Curve: UnSupportedEcPointMessage, }