Skip to content

Commit b8f8b99

Browse files
docs: Fix return value for functions that don't have invalid inputs
_tagged_sha256 simply cannot have invalid inputs. The other functions could in some sense have invalid inputs but only in violation of the type system. For example, a pubkey could be invalid but invalid objects of type secp256k1_pubkey either can't be obtained via the API or will be caught by an ARG_CHECK when calling pubkey_load. This is consistent with similar functions in the public API, e.g., _ec_pubkey_negate or _ec_pubkey_serialize.
1 parent f813bb0 commit b8f8b99

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

include/secp256k1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine(
814814
* implementations optimized for a specific tag can precompute the SHA256 state
815815
* after hashing the tag hashes.
816816
*
817-
* Returns 0 if the arguments are invalid and 1 otherwise.
817+
* Returns: 1 always.
818818
* Args: ctx: pointer to a context object
819819
* Out: hash32: pointer to a 32-byte array to store the resulting hash
820820
* In: tag: pointer to an array containing the tag

include/secp256k1_extrakeys.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ SECP256K1_API int secp256k1_xonly_pubkey_cmp(
8181

8282
/** Converts a secp256k1_pubkey into a secp256k1_xonly_pubkey.
8383
*
84-
* Returns: 1 if the public key was successfully converted
85-
* 0 otherwise
84+
* Returns: 1 always.
8685
*
8786
* Args: ctx: pointer to a context object.
8887
* Out: xonly_pubkey: pointer to an x-only public key object for placing the converted public key.
@@ -172,7 +171,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_create(
172171

173172
/** Get the secret key from a keypair.
174173
*
175-
* Returns: 0 if the arguments are invalid. 1 otherwise.
174+
* Returns: 1 always.
176175
* Args: ctx: pointer to a context object.
177176
* Out: seckey: pointer to a 32-byte buffer for the secret key.
178177
* In: keypair: pointer to a keypair.
@@ -185,7 +184,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_sec(
185184

186185
/** Get the public key from a keypair.
187186
*
188-
* Returns: 0 if the arguments are invalid. 1 otherwise.
187+
* Returns: 1 always.
189188
* Args: ctx: pointer to a context object.
190189
* Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to
191190
* the keypair public key. If not, it's set to an invalid value.
@@ -202,7 +201,7 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_keypair_pub(
202201
* This is the same as calling secp256k1_keypair_pub and then
203202
* secp256k1_xonly_pubkey_from_pubkey.
204203
*
205-
* Returns: 0 if the arguments are invalid. 1 otherwise.
204+
* Returns: 1 always.
206205
* Args: ctx: pointer to a context object.
207206
* Out: pubkey: pointer to an xonly_pubkey object. If 1 is returned, it is set
208207
* to the keypair public key after converting it to an

0 commit comments

Comments
 (0)