Skip to content

Commit 48f63ef

Browse files
committed
musig: remove unnecessary branch in pubkey_tweak_add
1 parent 5860b5e commit 48f63ef

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
@@ -152,6 +152,7 @@ int secp256k1_musig_pubkey_combine(const secp256k1_context* ctx, secp256k1_scrat
152152

153153
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) {
154154
secp256k1_ge pk;
155+
int ret;
155156

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

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

0 commit comments

Comments
 (0)