From f36d89f4363a25f7948a0f7096201ef8e15045d8 Mon Sep 17 00:00:00 2001 From: w0xlt Date: Fri, 16 Jan 2026 17:55:20 +0100 Subject: [PATCH] key: add `GetSecp256k1SignContext` access function This is needed in order to move the `CreateMuSig2{Nonce,PartialSig}` functions to the musig.cpp modules, see next two commits. --- src/key.cpp | 5 +++++ src/key.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/key.cpp b/src/key.cpp index f17a286750e..60f6eb67c1e 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -568,6 +568,11 @@ bool ECC_InitSanityCheck() { return key.VerifyPubKey(pubkey); } +secp256k1_context* GetSecp256k1SignContext() +{ + return secp256k1_context_sign; +} + /** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */ static void ECC_Start() { assert(secp256k1_context_sign == nullptr); diff --git a/src/key.h b/src/key.h index f35f3cc0156..e2c9d82fa5f 100644 --- a/src/key.h +++ b/src/key.h @@ -16,6 +16,8 @@ #include #include +struct secp256k1_context_struct; +typedef struct secp256k1_context_struct secp256k1_context; /** * CPrivKey is a serialized private key, with all parameters included @@ -315,6 +317,9 @@ private: /** Check that required EC support is available at runtime. */ bool ECC_InitSanityCheck(); +/** Access the secp256k1 context used for signing and MuSig2 nonce generation. */ +secp256k1_context* GetSecp256k1SignContext(); + /** * RAII class initializing and deinitializing global state for elliptic curve support. * Only one instance may be initialized at a time.