aboutsummaryrefslogtreecommitdiff
path: root/src/secp256k1/include/secp256k1_extrakeys.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2021-07-14 10:02:02 -0700
committerPieter Wuille <pieter@wuille.net>2021-07-14 14:43:45 -0700
commite4ffb44716bb7a7b9f0a5d70ac07058632234370 (patch)
treeb658b1afefbcbe30b42d819c59dd5172f64dc79b /src/secp256k1/include/secp256k1_extrakeys.h
parent531c2b7c04898f5a2097f44e8c12bfb2f53aaf9b (diff)
parentc020cbaa5c8e9e61b2b8efd8dc09be743fcd4273 (diff)
downloadbitcoin-e4ffb44716bb7a7b9f0a5d70ac07058632234370.tar.xz
Update secp256k1 subtree to latest upstream + adapt API
The new schnorrsig API requires changing a few arguments.
Diffstat (limited to 'src/secp256k1/include/secp256k1_extrakeys.h')
-rw-r--r--src/secp256k1/include/secp256k1_extrakeys.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/secp256k1/include/secp256k1_extrakeys.h b/src/secp256k1/include/secp256k1_extrakeys.h
index 6fc7b290f8..0a37fb6b9d 100644
--- a/src/secp256k1/include/secp256k1_extrakeys.h
+++ b/src/secp256k1/include/secp256k1_extrakeys.h
@@ -15,9 +15,9 @@ extern "C" {
* The exact representation of data inside is implementation defined and not
* guaranteed to be portable between different platforms or versions. It is
* however guaranteed to be 64 bytes in size, and can be safely copied/moved.
- * If you need to convert to a format suitable for storage, transmission, or
- * comparison, use secp256k1_xonly_pubkey_serialize and
- * secp256k1_xonly_pubkey_parse.
+ * If you need to convert to a format suitable for storage, transmission, use
+ * use secp256k1_xonly_pubkey_serialize and secp256k1_xonly_pubkey_parse. To
+ * compare keys, use secp256k1_xonly_pubkey_cmp.
*/
typedef struct {
unsigned char data[64];
@@ -67,6 +67,21 @@ SECP256K1_API int secp256k1_xonly_pubkey_serialize(
const secp256k1_xonly_pubkey* pubkey
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+/** Compare two x-only public keys using lexicographic order
+ *
+ * Returns: <0 if the first public key is less than the second
+ * >0 if the first public key is greater than the second
+ * 0 if the two public keys are equal
+ * Args: ctx: a secp256k1 context object.
+ * In: pubkey1: first public key to compare
+ * pubkey2: second public key to compare
+ */
+SECP256K1_API int secp256k1_xonly_pubkey_cmp(
+ const secp256k1_context* ctx,
+ const secp256k1_xonly_pubkey* pk1,
+ const secp256k1_xonly_pubkey* pk2
+) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
+
/** Converts a secp256k1_pubkey into a secp256k1_xonly_pubkey.
*
* Returns: 1 if the public key was successfully converted