Skip to content

Commit 58d9445

Browse files
committed
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.
1 parent 2c2c427 commit 58d9445

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/signer_mock.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ func (s *mockSigner) SignOutputRaw(ctx context.Context, tx *wire.MsgTx,
2727
SignDescriptors: signDescriptors,
2828
}
2929

30-
rawSigs := [][]byte{{1, 2, 3}}
30+
rawSigs := make([][]byte, len(signDescriptors))
31+
for i := range signDescriptors {
32+
sig := make([]byte, 64)
33+
sig[0] = byte(i + 1)
34+
rawSigs[i] = sig
35+
}
3136

3237
return rawSigs, nil
3338
}
@@ -118,7 +123,10 @@ func (s *mockSigner) MuSig2Sign(context.Context, [32]byte, [32]byte,
118123
func (s *mockSigner) MuSig2CombineSig(context.Context, [32]byte,
119124
[][]byte) (bool, []byte, error) {
120125

121-
return true, nil, nil
126+
sig := make([]byte, 64)
127+
sig[0] = 42
128+
129+
return true, sig, nil
122130
}
123131

124132
// MuSig2Cleanup removes a session from memory to free up resources.

0 commit comments

Comments
 (0)