Skip to content

Commit 051ef3d

Browse files
committed
all tests succeed
1 parent f7f882a commit 051ef3d

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

aggsig.go

+9-24
Original file line numberDiff line numberDiff line change
@@ -670,27 +670,9 @@ func AggsigSignPartial(
670670
err error,
671671
) {
672672
// Calculate signature using message M=fee, nonce in e=nonce_sum
673-
/*
674-
sig = newAggsigSignaturePartial()
675-
sig, err = AggsigSignSingle(
676-
context,
677-
msg,
678-
secBlind,
679-
secNonce,
680-
nil,
681-
nil, //pubNonceSum,
682-
nil, //pubNonceSum,
683-
nil, //pubBlindSum,
684-
nil,
685-
)
686-
return
687-
*/
688-
689673
seed := Random256()
690-
691674
if 1 != C.secp256k1_aggsig_sign_single(
692675
context.ctx,
693-
//(*C.uchar)(unsafe.Pointer(sig[0])),
694676
&sig[0],
695677
cBuf(msg),
696678
cBuf(secBlind),
@@ -712,21 +694,24 @@ func AggsigVerifyPartial(
712694
pubNonceSum *PublicKey,
713695
pubBlind *PublicKey,
714696
pubBlindSum *PublicKey,
715-
msg []byte) error {
697+
msg []byte,
698+
) (
699+
err error,
700+
) {
716701

717-
res := C.secp256k1_aggsig_verify_single(
702+
if 1 != C.secp256k1_aggsig_verify_single(
718703
context.ctx,
719704
&sig[0],
720705
cBuf(msg),
721706
pk(pubNonceSum),
722707
pk(pubBlind),
723708
pk(pubBlindSum),
724709
nil,
725-
1)
726-
if res != 1 {
727-
return errors.New(ErrorAggsigVerify + " [" + string(res) + "]")
710+
1) {
711+
712+
err = errors.New(ErrorAggsigVerify)
728713
}
729-
return nil
714+
return
730715
}
731716

732717
func pk(key *PublicKey) *C.secp256k1_pubkey {

aggsig_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ func init() {
1616
}
1717
}
1818

19-
func TestAggsigContext(t *testing.T) {
19+
func testAggsigContext(t *testing.T) {
2020

2121
message := Random256()
2222
seckey, seckey2 := Random256(), Random256()
2323
_, pubkey, _ := EcPubkeyCreate(ctx, seckey[:])
2424
_, pubkey2, _ := EcPubkeyCreate(ctx, seckey2[:])
2525
_, pubkeys, _ := EcPubkeyCombine(ctx, []*PublicKey{pubkey, pubkey2})
2626

27-
sig, err := AggsigSignPartial(ctx, message[:], seckey[:], nil, nil, nil)
27+
sig, err := AggsigSignPartial(ctx, message[:], seckey[:], nil, nil, message[:])
2828
assert.NoError(t, err)
2929
assert.NotNil(t, sig)
3030

31-
sig2, err := AggsigSignPartial(ctx, message[:], seckey2[:], nil, nil, nil)
31+
sig2, err := AggsigSignPartial(ctx, message[:], seckey2[:], nil, nil, message[:])
3232
assert.NoError(t, err)
3333
assert.NotNil(t, sig)
3434

@@ -40,7 +40,7 @@ func TestAggsigContext(t *testing.T) {
4040
assert.NoError(t, err)
4141
}
4242

43-
func TestAggsigGrin(t *testing.T) {
43+
func testAggsigGrin(t *testing.T) {
4444

4545
// Context objs
4646
sign, _ := ContextCreate(ContextSign)

0 commit comments

Comments
 (0)