gossipd: correclty ignore channel_announcement and channel_update for other chains.
What changed, and why it matters
This change fixes Core Lightning's gossip daemon so that it silently ignores Lightning network gossip messages meant for other blockchains, instead of reacting to them (previously it may have sent warning messages or processed them inappropriately). This aligns the code with the protocol specification and reduces unnecessary or risky behavior when receiving cross-chain gossip.
Apply the patch. It is a low-risk protocol-compliance fix. Monitor for any remaining cases where foreign-chain gossip triggers warnings or errors elsewhere in gossipd.
Security signals we found
Cross-chain gossip mishandling: messages for other chains were not being ignored as required by BOLT #7
Potential for warning/log spam or incorrect state processing from foreign-chain gossip
Protocol compliance fix with explicit BOLT #7 citation
Evidence from the diff
The patch adds chain_hash validation to gossmap_manage_channel_announcement() and gossmap_manage_channel_update() in gossipd/gossmap_manage.c. Before further processing, the functions now compare the message’s chain_hash against chainparams->genesis_blockhash and return NULL (ignore) if they differ. This implements BOLT #7’s requirement that receivers MUST ignore channel_announcement and channel_update messages for unknown chains. Previously the code apparently did not perform this check, causing it to send warnings or process gossip intended for other chains.
Changed components
gossipd/gossmap_manage.cgossmap_manage_channel_announcement()gossmap_manage_channel_update()Inspect captured patch +17 / −0
diff --git a/gossipd/gossmap_manage.c b/gossipd/gossmap_manage.c
index eee55a15..91a24757 100644
--- a/gossipd/gossmap_manage.c
+++ b/gossipd/gossmap_manage.c
@@ -662,6 +662,13 @@ const char *gossmap_manage_channel_announcement(const tal_t *ctx,
fmt_node_id(tmpctx, &node_id_2));
}
+ /* BOLT #7:
+ * - if the specified `chain_hash` is unknown to the receiver:
+ * - MUST ignore the message.
+ */
+ if (!bitcoin_blkid_eq(&chain_hash, &chainparams->genesis_blockhash))
+ return NULL;
+
/* If a prior txout lookup failed there is little point it trying
* again. Just drop the announcement and walk away whistling.
*
@@ -1033,6 +1040,16 @@ const char *gossmap_manage_channel_update(const tal_t *ctx,
tal_hex(tmpctx, update));
}
+ /* BOLT #7:
+ * - if the specified `chain_hash` value is unknown (meaning it isn't active on
+ * the specified chain):
+ * - MUST ignore the channel update.
+ */
+ if (!bitcoin_blkid_eq(&chain_hash, &chainparams->genesis_blockhash)) {
+ status_debug("wrong chain for update %s", tal_hex(tmpctx, update));
+ return NULL;
+ }
+
/* Don't accept ancient or far-future timestamps. */
if (!timestamp_reasonable(gm->daemon, timestamp)) {
status_debug("Unreasonable timestamp in %s", tal_hex(tmpctx, update));
Why this scored 37/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.