input+lnwallet: move some MuSig2 calls to input pkg

As a preparation for making it possible to version switch calls to the
MuSig2 API, we move some of the calls to the input package where in a
future commit we'll call the corresponding code in the correct package.
This commit is contained in:
Oliver Gugger committed 2023-02-03 18:30:09 +01:00
1 parent 4f5ede84c6
commit 13789f5d95
4 files changed
+217 -43

No files matched your search

+8 -24
View File
@@ -826,18 +826,10 @@ func (s *Server) MuSig2CombineKeys(_ context.Context,
// Parse the public keys of all signing participants. This must also
// include our own, local key.
allSignerPubKeys := make([]*btcec.PublicKey, len(in.AllSignerPubkeys))
if len(in.AllSignerPubkeys) < 2 {
return nil, fmt.Errorf("need at least two signing public keys")
}
for idx, pubKeyBytes := range in.AllSignerPubkeys {
pubKey, err := schnorr.ParsePubKey(pubKeyBytes)
if err != nil {
return nil, fmt.Errorf("error parsing signer public "+
"key %d: %v", idx, err)
}
allSignerPubKeys[idx] = pubKey
allSignerPubKeys, err := input.MuSig2ParsePubKeys(in.AllSignerPubkeys)
if err != nil {
return nil, fmt.Errorf("error parsing all signer public "+
"keys: %w", err)
}
// Are there any tweaks to apply to the combined public key?
@@ -887,18 +879,10 @@ func (s *Server) MuSig2CreateSession(_ context.Context,
// Parse the public keys of all signing participants. This must also
// include our own, local key.
allSignerPubKeys := make([]*btcec.PublicKey, len(in.AllSignerPubkeys))
if len(in.AllSignerPubkeys) < 2 {
return nil, fmt.Errorf("need at least two signing public keys")
}
for idx, pubKeyBytes := range in.AllSignerPubkeys {
pubKey, err := schnorr.ParsePubKey(pubKeyBytes)
if err != nil {
return nil, fmt.Errorf("error parsing signer public "+
"key %d: %v", idx, err)
}
allSignerPubKeys[idx] = pubKey
allSignerPubKeys, err := input.MuSig2ParsePubKeys(in.AllSignerPubkeys)
if err != nil {
return nil, fmt.Errorf("error parsing all signer public "+
"keys: %w", err)
}
// We participate a nonce ourselves, so we can't have more nonces than