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

Function channel_update_from_onion_error

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

1414/* Return NULL if the wrapped onion error message has no channel_update field,
1415 * or return the embedded channel_update message otherwise. */
1416static u8 *channel_update_from_onion_error(const tal_t *ctx,
1417 const u8 *onion_message)
1418{
1419 u8 *channel_update = NULL;
1420 struct amount_msat unused_msat;
1421 u32 unused32;
1422
1423 /* Identify failcodes that have some channel_update.
1424 *
1425 * TODO > BOLT 1.0: Add new failcodes when updating to a
1426 * new BOLT version. */
1427 if (!fromwire_temporary_channel_failure(ctx,
1428 onion_message,
1429 &channel_update) &&
1430 !fromwire_amount_below_minimum(ctx,
1431 onion_message, &unused_msat,
1432 &channel_update) &&
1433 !fromwire_fee_insufficient(ctx,
1434 onion_message, &unused_msat,
1435 &channel_update) &&
1436 !fromwire_incorrect_cltv_expiry(ctx,
1437 onion_message, &unused32,
1438 &channel_update) &&
1439 !fromwire_expiry_too_soon(ctx,
1440 onion_message,
1441 &channel_update))
1442 /* No channel update. */
1443 return NULL;
1444
1445 return patch_channel_update(ctx, take(channel_update));
1446}
1447
1448
1449static struct command_result *

Callers 1

Calls 1

patch_channel_updateFunction · 0.85

Tested by

no test coverage detected