MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_init_cupdate

Function handle_init_cupdate

lightningd/gossip_control.c:117–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117static void handle_init_cupdate(struct lightningd *ld, const u8 *msg)
118{
119 struct short_channel_id scid;
120 u8 *update;
121 struct channel *channel;
122
123 if (!fromwire_gossipd_init_cupdate(msg, msg, &scid, &update)) {
124 fatal("Gossip gave bad GOSSIPD_INIT_CUPDATE %s",
125 tal_hex(msg, msg));
126 }
127
128 channel = any_channel_by_scid(ld, scid, true);
129 if (!channel) {
130 log_broken(ld->log, "init_cupdate for unknown scid %s: telling gossipd it's spent",
131 fmt_short_channel_id(tmpctx, scid));
132 /* Presumably gossipd missed that it was already spent, so
133 * tell it now! (We need a tal object for this, hence
134 * tal_dup) */
135 gossipd_notify_spends(ld, ld->gossip_blockheight,
136 tal_dup(tmpctx, struct short_channel_id, &scid));
137 return;
138 }
139
140 channel_gossip_update_from_gossipd(channel, take(update));
141}
142
143static void handle_init_nannounce(struct lightningd *ld, const u8 *msg)
144{

Callers 1

gossip_msgFunction · 0.85

Calls 6

tal_hexFunction · 0.85
fmt_short_channel_idFunction · 0.85
gossipd_notify_spendsFunction · 0.85
fatalFunction · 0.70
any_channel_by_scidFunction · 0.70

Tested by

no test coverage detected