Skip to content

Commit 5c04b8d

Browse files
committed
test: add richer implementation to MuSig2CreateSession
1 parent 1abbe64 commit 5c04b8d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/signer_mock.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package test
33
import (
44
"bytes"
55
"context"
6+
"encoding/hex"
67
"fmt"
78

89
"github.com/btcsuite/btcd/btcec/v2"
10+
"github.com/btcsuite/btcd/btcec/v2/schnorr"
911
"github.com/btcsuite/btcd/wire"
1012
"github.com/lightninglabs/lndclient"
1113
"github.com/lightningnetwork/lnd/input"
@@ -68,7 +70,21 @@ func (s *mockSigner) MuSig2CreateSession(context.Context, *keychain.KeyLocator,
6870
[][32]byte, ...lndclient.MuSig2SessionOpts) (*input.MuSig2SessionInfo,
6971
error) {
7072

71-
return nil, nil
73+
const testPubKey = "F9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9"
74+
pubKeyBytes, err := hex.DecodeString(testPubKey)
75+
if err != nil {
76+
return nil, err
77+
}
78+
79+
combinedKey, err := schnorr.ParsePubKey(pubKeyBytes)
80+
if err != nil {
81+
return nil, err
82+
}
83+
84+
return &input.MuSig2SessionInfo{
85+
CombinedKey: combinedKey,
86+
HaveAllNonces: true,
87+
}, nil
7288
}
7389

7490
// MuSig2RegisterNonces registers one or more public nonces of other signing
@@ -77,7 +93,7 @@ func (s *mockSigner) MuSig2CreateSession(context.Context, *keychain.KeyLocator,
7793
func (s *mockSigner) MuSig2RegisterNonces(context.Context, [32]byte,
7894
[][66]byte) (bool, error) {
7995

80-
return false, nil
96+
return true, nil
8197
}
8298

8399
// MuSig2Sign creates a partial signature using the local signing key

0 commit comments

Comments
 (0)