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

Function channel_update_for_error

lightningd/channel.c:1335–1352  ·  view source on GitHub ↗

BOLT #4: * An _intermediate hop_ MUST NOT, but the _final node_: *... * - if it returns a `channel_update`: * - MUST set `short_channel_id` to the `short_channel_id` used * by the incoming onion. */ So, if the scid doesn't match (redirect or we chose an equivalent * channel), we simply don't return an update. */

Source from the content-addressed store, hash-verified

1333/* So, if the scid doesn't match (redirect or we chose an equivalent
1334 * channel), we simply don't return an update. */
1335const u8 *channel_update_for_error(const tal_t *ctx,
1336 const struct htlc_in *hin,
1337 struct channel *channel)
1338{
1339 if (!hin || !hin->payload || !hin->payload->forward_channel)
1340 return NULL;
1341
1342 /* We shouldn't have forwarded to the channel if it wasn't
1343 * allowed to use that scid, so we can keep it simple here. */
1344 if ((!channel->alias[LOCAL]
1345 || !short_channel_id_eq(*hin->payload->forward_channel, *channel->alias[LOCAL]))
1346 && (!channel->scid
1347 || !short_channel_id_eq(*hin->payload->forward_channel, *channel->scid))) {
1348 return NULL;
1349 }
1350
1351 return channel_gossip_update_for_error(ctx, channel);
1352}
1353

Callers 4

destroy_hout_subd_diedFunction · 0.85
rcvd_htlc_replyFunction · 0.85
send_htlc_outFunction · 0.85
forward_htlcFunction · 0.85

Calls 2

short_channel_id_eqFunction · 0.85

Tested by

no test coverage detected