mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
lnwire: add Record() method to lnwire.Sig
We'll use this later on to re-use the normal primitive record to create a series of new TLV types for the new co-op close protocol.
This commit is contained in:
parent
63e698ec49
commit
34fd35bc63
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
|
"github.com/lightningnetwork/lnd/tlv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -64,6 +65,17 @@ func (s *Sig) Copy() Sig {
|
|||||||
return sCopy
|
return sCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Record returns a Record that can be used to encode or decode the backing
|
||||||
|
// object.
|
||||||
|
//
|
||||||
|
// This returns a record that serializes the sig as a 64-byte fixed size
|
||||||
|
// signature.
|
||||||
|
func (s *Sig) Record() tlv.Record {
|
||||||
|
// We set a type here as zero as it isn't needed when used as a
|
||||||
|
// RecordT.
|
||||||
|
return tlv.MakePrimitiveRecord(0, &s.bytes)
|
||||||
|
}
|
||||||
|
|
||||||
// NewSigFromWireECDSA returns a Sig instance based on an ECDSA signature
|
// NewSigFromWireECDSA returns a Sig instance based on an ECDSA signature
|
||||||
// that's already in the 64-byte format we expect.
|
// that's already in the 64-byte format we expect.
|
||||||
func NewSigFromWireECDSA(sig []byte) (Sig, error) {
|
func NewSigFromWireECDSA(sig []byte) (Sig, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user