lnwire: update Sig to support both ECDSA and schnorr sigs

In this commit, we update the Sig type to support ECDSA and schnorr
signatures. We need to do this as the HTLC signatures will become
schnorr sigs for taproot channels. The current spec draft opts to
overload this field since both the sigs are actually 64 bytes in length.
The only consideration with this move is that callers need to "coerce" a
sig to the proper type if they need schnorr signatures.
This commit is contained in:
Olaoluwa Osuntokun committed 2023-08-22 16:29:19 -07:00
1 parent eccc77315b
commit b368e476c5
29 files changed
+296 -128

No files matched your search

+4 -4
View File
@@ -596,12 +596,12 @@ func FuzzCustomMessage(f *testing.F) {
// does not mutate them.
func FuzzParseRawSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
sig, err := NewSigFromRawSignature(data)
sig, err := NewSigFromECDSARawSignature(data)
if err != nil {
return
}
sig2, err := NewSigFromRawSignature(sig.ToSignatureBytes())
sig2, err := NewSigFromECDSARawSignature(sig.ToSignatureBytes())
require.NoError(t, err, "failed to reparse signature")
require.Equal(t, sig, sig2, "signature mismatch")
@@ -614,10 +614,10 @@ func FuzzParseRawSignature(f *testing.F) {
func FuzzConvertFixedSignature(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
var sig Sig
if len(data) > len(sig) {
if len(data) > len(sig.bytes[:]) {
return
}
copy(sig[:], data)
copy(sig.bytes[:], data)
derSig, err := sig.ToSignature()
if err != nil {