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

Function channel_update_from_onion_error

plugins/libplugin-pay.c:1575–1605  ·  view source on GitHub ↗

Return NULL if the wrapped onion error message has no channel_update field, * or return the embedded channel_update message otherwise. */

Source from the content-addressed store, hash-verified

1573/* Return NULL if the wrapped onion error message has no channel_update field,
1574 * or return the embedded channel_update message otherwise. */
1575static u8 *channel_update_from_onion_error(const tal_t *ctx,
1576 const u8 *onion_message)
1577{
1578 u8 *channel_update = NULL;
1579 struct amount_msat unused_msat;
1580 u32 unused32;
1581
1582 /* Identify failcodes that have some channel_update.
1583 *
1584 * TODO > BOLT 1.0: Add new failcodes when updating to a
1585 * new BOLT version. */
1586 if (!fromwire_temporary_channel_failure(ctx,
1587 onion_message,
1588 &channel_update) &&
1589 !fromwire_amount_below_minimum(ctx,
1590 onion_message, &unused_msat,
1591 &channel_update) &&
1592 !fromwire_fee_insufficient(ctx,
1593 onion_message, &unused_msat,
1594 &channel_update) &&
1595 !fromwire_incorrect_cltv_expiry(ctx,
1596 onion_message, &unused32,
1597 &channel_update) &&
1598 !fromwire_expiry_too_soon(ctx,
1599 onion_message,
1600 &channel_update))
1601 /* No channel update. */
1602 return NULL;
1603
1604 return patch_channel_update(ctx, take(channel_update));
1605}
1606
1607
1608static struct command_result *

Callers 1

Calls 1

patch_channel_updateFunction · 0.70

Tested by

no test coverage detected