lnwire: add Outpoint to ChannelAnnouncement2

The latest version of the spec has the outpoint included in the
`channel_announcement2` message.
This commit is contained in:
Elle Mouton committed 2025-10-01 13:13:32 +02:00
1 parent 004a68e524
commit 8372524edf
3 files changed
+21

No files matched your search

+6
View File
@@ -56,6 +56,9 @@ type ChannelAnnouncement2 struct {
// the funding output is a pure 2-of-2 MuSig aggregate public key.
MerkleRootHash tlv.OptionalRecordT[tlv.TlvType16, [32]byte]
// Outpoint is the outpoint of the funding transaction.
Outpoint tlv.RecordT[tlv.TlvType18, OutPoint]
// Signature is a Schnorr signature over serialised signed-range TLV
// stream of the message.
Signature tlv.RecordT[tlv.TlvType160, Sig]
@@ -121,6 +124,7 @@ func (c *ChannelAnnouncement2) nonSignatureRecordProducers() []tlv.RecordProduce
},
)
recordProducers = append(recordProducers, &c.Outpoint)
recordProducers = append(recordProducers, RecordsAsProducers(
tlv.MapToRecords(c.ExtraSignedFields),
)...)
@@ -149,6 +153,7 @@ func (c *ChannelAnnouncement2) Decode(r io.Reader, _ uint32) error {
&btcKey1,
&btcKey2,
&merkleRootHash,
&c.Outpoint,
&c.Signature,
)...)
if err != nil {
@@ -202,6 +207,7 @@ func (c *ChannelAnnouncement2) DecodeNonSigTLVRecords(r io.Reader) error {
&btcKey1,
&btcKey2,
&merkleRootHash,
&c.Outpoint,
)...)
if err != nil {
return err
+11
View File
@@ -58,6 +58,17 @@ func TestChanAnn2EncodeDecode(t *testing.T) {
0xb3, 0xee, 0x17, 0x2f, 0x7f, 0x16, 0x1, 0xe6, 0x7d, 0x1d, 0xa6,
0xca, 0xd4, 0xb, 0x54, 0xc4, 0x46, 0x8d, 0x48, 0x23, 0x6c, 0x39,
// Outpoint record.
0x12, // type (18).
0x22, // length (34 bytes).
// Hash (32 bytes).
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
// Index (2 bytes).
0x30, 0x39, // value: 12345.
// Unknown TLV record.
0x6f, // type.
0x2, // length.
+4
View File
@@ -291,6 +291,10 @@ func (c *ChannelAnnouncement2) RandTestMessage(t *rapid.T) Message {
)
}
msg.Outpoint = tlv.NewRecordT[tlv.TlvType18, OutPoint](
OutPoint(RandOutPoint(t)),
)
return msg
}