diff --git a/btcec/schnorr/musig2/context.go b/btcec/schnorr/musig2/context.go index 44ed69c8..7ed759cd 100644 --- a/btcec/schnorr/musig2/context.go +++ b/btcec/schnorr/musig2/context.go @@ -234,24 +234,23 @@ func NewContext(signingKey *btcec.PrivateKey, shouldSort bool, opts.keySet = make([]*btcec.PublicKey, 0, opts.numSigners) opts.keySet = append(opts.keySet, pubKey) - // If early nonce generation is specified, then we'll generate - // the nonce now to pass in to the session once all the callers - // are known. - if opts.earlyNonce { - var err error - ctx.sessionNonce, err = GenNonces( - WithPublicKey(ctx.pubKey), - WithNonceSecretKeyAux(signingKey), - ) - if err != nil { - return nil, err - } - } - default: return nil, ErrSignersNotSpecified } + // If early nonce generation is specified, then we'll generate the + // nonce now to pass in to the session once all the callers are known. + if opts.earlyNonce { + var err error + ctx.sessionNonce, err = GenNonces( + WithPublicKey(ctx.pubKey), + WithNonceSecretKeyAux(signingKey), + ) + if err != nil { + return nil, err + } + } + return ctx, nil }