From 58d9445bc56c4ce550db8659bc8d2675d27a7b6f Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 11 Jul 2024 23:24:06 -0300 Subject: [PATCH] test/signer_mock: return signatures of real size Size of a signature affects the weight of transaction, which is verified in tests. Also method SignOutputRaw now returns the number of signatures matching the number of signature descriptors to prevent crashes in tests where multiple inputs are signed. --- test/signer_mock.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/signer_mock.go b/test/signer_mock.go index e7f3762..985e857 100644 --- a/test/signer_mock.go +++ b/test/signer_mock.go @@ -27,7 +27,12 @@ func (s *mockSigner) SignOutputRaw(ctx context.Context, tx *wire.MsgTx, SignDescriptors: signDescriptors, } - rawSigs := [][]byte{{1, 2, 3}} + rawSigs := make([][]byte, len(signDescriptors)) + for i := range signDescriptors { + sig := make([]byte, 64) + sig[0] = byte(i + 1) + rawSigs[i] = sig + } return rawSigs, nil } @@ -118,7 +123,10 @@ func (s *mockSigner) MuSig2Sign(context.Context, [32]byte, [32]byte, func (s *mockSigner) MuSig2CombineSig(context.Context, [32]byte, [][]byte) (bool, []byte, error) { - return true, nil, nil + sig := make([]byte, 64) + sig[0] = 42 + + return true, sig, nil } // MuSig2Cleanup removes a session from memory to free up resources.