2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-09 19:10:47 +00:00

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.
This commit is contained in:
Boris Nagaev 2024-07-11 23:24:06 -03:00
parent 2c2c427a6d
commit 58d9445bc5
No known key found for this signature in database

View File

@ -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.