musig: Move MUSIG_CHAINCODE to musig.cpp
What changed, and why it matters
This commit simply moves a constant value (MUSIG_CHAINCODE) from a header file to the source file where it is actually used. It is a routine code cleanup with no functional change and no security relevance.
No action required. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change relocates the constexpr uint256 MUSIG_CHAINCODE from src/musig.h to src/musig.cpp. The constant remains identical and is only used internally in musig.cpp. The using namespace util::hex_literals directive is also moved. No logic, values, or behavior are altered.
Changed components
src/musig.cppsrc/musig.hInspect captured patch +7 / −9
diff --git a/src/musig.cpp b/src/musig.cpp
index 686ec5e8..706874be 100644
--- a/src/musig.cpp
+++ b/src/musig.cpp
@@ -7,6 +7,13 @@
#include <secp256k1_musig.h>
+//! MuSig2 chaincode as defined by BIP 328
+using namespace util::hex_literals;
+constexpr uint256 MUSIG_CHAINCODE{
+ // Use immediate lambda to work around GCC-14 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117966
+ []() consteval { return uint256{"868087ca02a6f974c4598924c36b57762d32cb45717167e300622c7167e38965"_hex_u8}; }(),
+};
+
static bool GetMuSig2KeyAggCache(const std::vector<CPubKey>& pubkeys, secp256k1_musig_keyagg_cache& keyagg_cache)
{
// Parse the pubkeys
diff --git a/src/musig.h b/src/musig.h
index 10234568..f518ae81 100644
--- a/src/musig.h
+++ b/src/musig.h
@@ -14,15 +14,6 @@ struct secp256k1_musig_keyagg_cache;
class MuSig2SecNonceImpl;
struct secp256k1_musig_secnonce;
-//! MuSig2 chaincode as defined by BIP 328
-using namespace util::hex_literals;
-constexpr uint256 MUSIG_CHAINCODE{
- // Use immediate lambda to work around GCC-14 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117966
- []() consteval { return uint256{"868087ca02a6f974c4598924c36b57762d32cb45717167e300622c7167e38965"_hex_u8}; }(),
-};
-
-
-
constexpr size_t MUSIG2_PUBNONCE_SIZE{66};
//! Compute the full aggregate pubkey from the given participant pubkeys in their current order.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.