From eef9fbc5c9f517d8bc03d79ce96854e151d735cf Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 25 Oct 2022 16:33:21 -0700 Subject: [PATCH] btcec/schnorr/musig2: always pass in priv key for early nonce gen This helps mitigate an issue discovered in musig2 under certain scenarios: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-October/021000.html. --- btcec/schnorr/musig2/context.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/btcec/schnorr/musig2/context.go b/btcec/schnorr/musig2/context.go index adbedb8b..0dfc6f38 100644 --- a/btcec/schnorr/musig2/context.go +++ b/btcec/schnorr/musig2/context.go @@ -239,7 +239,9 @@ func NewContext(signingKey *btcec.PrivateKey, shouldSort bool, // are known. if opts.earlyNonce { var err error - ctx.sessionNonce, err = GenNonces() + ctx.sessionNonce, err = GenNonces( + WithNonceSecretKeyAux(signingKey), + ) if err != nil { return nil, err }