multi: add version to MuSig2 API, bump btcd/btcec to v2.3.2

With this commit we bump the github.com/btcd/btcec/v2 library to v2.3.2
which implements the MuSig2 BIP version v1.0.0rc2. With this the
github.com/btcsuite/btcd/btcec/v2/schnorr/musig2 package becomes
v1.0.0rc2 and the github.com/lightningnetwork/lnd/internal/musig2v040
stays at the old v0.4.0 version.
This commit is contained in:
Oliver Gugger
2023-01-27 16:13:17 +01:00
parent 0e5ce71b33
commit ce5fa2e043
10 changed files with 323 additions and 39 deletions

View File

@@ -488,8 +488,9 @@ type muSig2State struct {
// all signing parties must be provided, including the public key of the local
// signing key. If nonces of other parties are already known, they can be
// submitted as well to reduce the number of method calls necessary later on.
func (b *BtcWallet) MuSig2CreateSession(keyLoc keychain.KeyLocator,
allSignerPubKeys []*btcec.PublicKey, tweaks *input.MuSig2Tweaks,
func (b *BtcWallet) MuSig2CreateSession(bipVersion input.MuSig2Version,
keyLoc keychain.KeyLocator, allSignerPubKeys []*btcec.PublicKey,
tweaks *input.MuSig2Tweaks,
otherSignerNonces [][musig2.PubNonceSize]byte) (*input.MuSig2SessionInfo,
error) {
@@ -503,10 +504,10 @@ func (b *BtcWallet) MuSig2CreateSession(keyLoc keychain.KeyLocator,
return nil, fmt.Errorf("error deriving private key: %v", err)
}
// Create a signing context with the given private key and list of all
// known signer public keys.
// Create a signing context and session with the given private key and
// list of all known signer public keys.
muSigContext, muSigSession, err := input.MuSig2CreateContext(
privKey, allSignerPubKeys, tweaks,
bipVersion, privKey, allSignerPubKeys, tweaks,
)
if err != nil {
return nil, fmt.Errorf("error creating signing context: %v",
@@ -535,6 +536,7 @@ func (b *BtcWallet) MuSig2CreateSession(keyLoc keychain.KeyLocator,
SessionID: input.NewMuSig2SessionID(
combinedKey, muSigSession.PublicNonce(),
),
Version: bipVersion,
PublicNonce: muSigSession.PublicNonce(),
CombinedKey: combinedKey,
TaprootTweak: tweaks.HasTaprootTweak(),