Skip to content

Commit 9caa335

Browse files
committed
musig: remove unnecessary branch in pubkey_tweak_add
1 parent 4c883dd commit 9caa335

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/modules/musig/main_impl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ int secp256k1_musig_pubkey_combine(const secp256k1_context* ctx, secp256k1_scrat
151151

152152
int secp256k1_musig_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_musig_pre_session *pre_session, secp256k1_pubkey *output_pubkey, const secp256k1_xonly_pubkey *internal_pubkey, const unsigned char *tweak32) {
153153
secp256k1_ge pk;
154+
int ret;
154155

155156
VERIFY_CHECK(ctx != NULL);
156157
ARG_CHECK(pre_session != NULL);
@@ -167,9 +168,10 @@ int secp256k1_musig_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_mus
167168
memcpy(pre_session->tweak, tweak32, 32);
168169
pre_session->is_tweaked = 1;
169170

170-
if (!secp256k1_pubkey_load(ctx, &pk, output_pubkey)) {
171-
return 0;
172-
}
171+
ret = secp256k1_pubkey_load(ctx, &pk, output_pubkey);
172+
/* Successful xonly_pubkey_tweak_add always returns valid output_pubkey */
173+
VERIFY_CHECK(ret);
174+
173175
pre_session->pk_parity = secp256k1_extrakeys_ge_even_y(&pk);
174176
return 1;
175177
}

0 commit comments

Comments
 (0)