diff --git a/lnwire/channel_announcement_2.go b/lnwire/channel_announcement_2.go index 0066dad2b..a82624a51 100644 --- a/lnwire/channel_announcement_2.go +++ b/lnwire/channel_announcement_2.go @@ -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 diff --git a/lnwire/channel_announcement_2_test.go b/lnwire/channel_announcement_2_test.go index 40d255b55..3a2ce28a9 100644 --- a/lnwire/channel_announcement_2_test.go +++ b/lnwire/channel_announcement_2_test.go @@ -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. diff --git a/lnwire/test_message.go b/lnwire/test_message.go index 0c2fe5e55..6fb6725a0 100644 --- a/lnwire/test_message.go +++ b/lnwire/test_message.go @@ -291,6 +291,10 @@ func (c *ChannelAnnouncement2) RandTestMessage(t *rapid.T) Message { ) } + msg.Outpoint = tlv.NewRecordT[tlv.TlvType18, OutPoint]( + OutPoint(RandOutPoint(t)), + ) + return msg }