Skip to content

Commit 57221bd

Browse files
committed
discovery: fix bug that can lead to sending invalid chan_ann msgs
Initially in lnd, we didn't store the extra TLV data that could be dangling off of gossip messages. This was fixed initially in lnd v0.5 with this PR: #1825. Within the PR, we incorrect set the `ExtraOpaqueData` (extra TLV blob) of the `ChannelAnnouncement` to the value stored in `edge`, which is actually our channel update. As 6-ish years ago we didn't yet have anything that used the TLV gossip fields, this went unnoticed. Fast forward to 2024, we shipped an experimental version of inbounbd fees. This starts to store additional data in the `ExtraOpaqueData` field, the TLV for the inbound fee. Initially, everything is valid when the first `ChannelAnnouncement` is sent, but as soon as a user attempts to set an inbound fee policy, we'd incorrectly swap in that new serialized TLV for the _channel announcement_: 841e243#diff-1eda595bbebe495bd74a6a0431c46b66cb4e8b53beb311067c010feac2665dcbR2560. Since we're just trying to generate a new `channel_update`, we don't also regenerate the signature for the `channel_announcement` message. As a result, we end up storing a `channel_announcement` with an invalid sig on disk, continuing to broadcast that to peers.
1 parent 8f25de0 commit 57221bd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

discovery/gossiper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,7 @@ func (d *AuthenticatedGossiper) updateChannel(info *models.ChannelEdgeInfo,
22322232
BitcoinKey1: info.BitcoinKey1Bytes,
22332233
Features: lnwire.NewRawFeatureVector(),
22342234
BitcoinKey2: info.BitcoinKey2Bytes,
2235-
ExtraOpaqueData: edge.ExtraOpaqueData,
2235+
ExtraOpaqueData: info.ExtraOpaqueData,
22362236
}
22372237
chanAnn.NodeSig1, err = lnwire.NewSigFromECDSARawSignature(
22382238
info.AuthProof.NodeSig1Bytes,

docs/release-notes/release-notes-0.18.3.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ commitment when the channel was force closed.
6464
cause UpdateAddHTLC message with blinding point fields to not be re-forwarded
6565
correctly on restart.
6666

67+
* [A bug has been fixed that could cause invalid channel
68+
announcements](https://github.com/lightningnetwork/lnd/pull/9002) to be
69+
generated if the inbound fee discount is used.
70+
6771
# New Features
6872
## Functional Enhancements
6973
## RPC Additions

0 commit comments

Comments
 (0)