mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
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:
@@ -183,7 +183,7 @@ func WriteElement(w *bytes.Buffer, element interface{}) error {
|
||||
|
||||
case Sig:
|
||||
// Write buffer
|
||||
if _, err := w.Write(e[:]); err != nil {
|
||||
if _, err := w.Write(e.bytes[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ func ReadElement(r io.Reader, element interface{}) error {
|
||||
*e = sigs
|
||||
|
||||
case *Sig:
|
||||
if _, err := io.ReadFull(r, e[:]); err != nil {
|
||||
if _, err := io.ReadFull(r, e.bytes[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user