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

Function channel_update_from_onion_error

plugins/libplugin-pay.c:1559–1589  ·  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

1557/* Return NULL if the wrapped onion error message has no channel_update field,
1558 * or return the embedded channel_update message otherwise. */
1559static u8 *channel_update_from_onion_error(const tal_t *ctx,
1560 const u8 *onion_message)
1561{
1562 u8 *channel_update = NULL;
1563 struct amount_msat unused_msat;
1564 u32 unused32;
1565
1566 /* Identify failcodes that have some channel_update.
1567 *
1568 * TODO > BOLT 1.0: Add new failcodes when updating to a
1569 * new BOLT version. */
1570 if (!fromwire_temporary_channel_failure(ctx,
1571 onion_message,
1572 &channel_update) &&
1573 !fromwire_amount_below_minimum(ctx,
1574 onion_message, &unused_msat,
1575 &channel_update) &&
1576 !fromwire_fee_insufficient(ctx,
1577 onion_message, &unused_msat,
1578 &channel_update) &&
1579 !fromwire_incorrect_cltv_expiry(ctx,
1580 onion_message, &unused32,
1581 &channel_update) &&
1582 !fromwire_expiry_too_soon(ctx,
1583 onion_message,
1584 &channel_update))
1585 /* No channel update. */
1586 return NULL;
1587
1588 return patch_channel_update(ctx, take(channel_update));
1589}
1590
1591
1592static struct command_result *

Callers 1

Calls 1

patch_channel_updateFunction · 0.70

Tested by

no test coverage detected