mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-12 19:02:12 +01:00
musig2: fix early nonce gen option
Previously the early nonce generation option was not being respected when creating the context, with the WithKnownSigners option being used. This commit fixes that.
This commit is contained in:
parent
f5eeb10d03
commit
8f84bb0e9b
1 changed files with 13 additions and 14 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue