Skip to content

Commit 983711c

Browse files
musig/tests: Refactor vectors_signverify
for improved readability
1 parent 73a6959 commit 983711c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/modules/musig/tests_impl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,12 +910,14 @@ static void musig_test_vectors_signverify(void) {
910910
* the signing key does not belong to any pubkey. */
911911
continue;
912912
}
913+
913914
expected = c->error != MUSIG_PUBKEY;
914915
CHECK(expected == musig_vectors_keyagg_and_tweak(&error, &keyagg_cache, NULL, vector->pubkeys, NULL, c->key_indices_len, c->key_indices, 0, NULL, NULL));
915916
CHECK(expected || c->error == error);
916917
if (!expected) {
917918
continue;
918919
}
920+
CHECK(secp256k1_ec_pubkey_parse(CTX, &pubkey, vector->pubkeys[0], sizeof(vector->pubkeys[0])));
919921

920922
expected = c->error != MUSIG_AGGNONCE;
921923
CHECK(expected == secp256k1_musig_aggnonce_parse(CTX, &aggnonce, vector->aggnonces[c->aggnonce_index]));
@@ -924,9 +926,8 @@ static void musig_test_vectors_signverify(void) {
924926
}
925927
CHECK(secp256k1_musig_nonce_process(CTX, &session, &aggnonce, vector->msgs[c->msg_index], &keyagg_cache));
926928

927-
CHECK(secp256k1_ec_pubkey_parse(CTX, &pubkey, vector->pubkeys[0], sizeof(vector->pubkeys[0])));
928-
musig_test_set_secnonce(&secnonce, vector->secnonces[c->secnonce_index], &pubkey);
929929
expected = c->error != MUSIG_SECNONCE;
930+
musig_test_set_secnonce(&secnonce, vector->secnonces[c->secnonce_index], &pubkey);
930931
if (expected) {
931932
CHECK(secp256k1_musig_partial_sign(CTX, &partial_sig, &secnonce, &keypair, &keyagg_cache, &session));
932933
} else {

0 commit comments

Comments
 (0)