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

Function process_channel_update_from_onion_error

plugins/xpay/xpay.c:702–813  ·  view source on GitHub ↗

Return true if this contained a channel_update which (potentially) changed something. */

Source from the content-addressed store, hash-verified

700
701/* Return true if this contained a channel_update which (potentially) changed something. */
702static bool process_channel_update_from_onion_error(struct command *aux_cmd,
703 struct attempt *attempt,
704 const u8 *onion_message,
705 const char *errname)
706{
707 u8 *channel_update;
708 struct amount_msat unused_msat;
709 u32 unused32;
710 secp256k1_ecdsa_signature signature;
711 struct bitcoin_blkid chain_hash;
712 struct short_channel_id_dir scidd;
713 u32 timestamp;
714 u8 message_flags, channel_flags;
715 u16 cltv_expiry_delta;
716 struct amount_msat htlc_minimum_msat, htlc_maximum_msat;
717 u32 fee_base_msat, fee_proportional_millionths;
718 struct out_req *req;
719 const struct gossmap *gossmap;
720 const struct gossmap_chan *c;
721
722 /* Identify failcodes that have some channel_update.
723 *
724 * TODO > BOLT 1.0: Add new failcodes when updating to a
725 * new BOLT version. */
726 if (!fromwire_temporary_channel_failure(tmpctx,
727 onion_message,
728 &channel_update) &&
729 !fromwire_amount_below_minimum(tmpctx,
730 onion_message, &unused_msat,
731 &channel_update) &&
732 !fromwire_fee_insufficient(tmpctx,
733 onion_message, &unused_msat,
734 &channel_update) &&
735 !fromwire_incorrect_cltv_expiry(tmpctx,
736 onion_message, &unused32,
737 &channel_update) &&
738 !fromwire_expiry_too_soon(tmpctx,
739 onion_message,
740 &channel_update))
741 /* No channel update. */
742 return false;
743
744 /* LND before v0.18 (May 2024) would not include the
745 * WIRE_CHANNEL_UPDATE type field, but now they do. */
746 if (!fromwire_channel_update(channel_update,
747 &signature,
748 &chain_hash,
749 &scidd.scid,
750 &timestamp,
751 &message_flags,
752 &channel_flags,
753 &cltv_expiry_delta,
754 &htlc_minimum_msat,
755 &fee_base_msat,
756 &fee_proportional_millionths,
757 &htlc_maximum_msat))
758 return false;
759

Callers 1

Calls 15

xpay_ofFunction · 0.85
gossmap_find_chanFunction · 0.85
gossmap_chan_setFunction · 0.85
u64_to_fp16Function · 0.85
attempt_logFunction · 0.85
fmt_short_channel_id_dirFunction · 0.85
tal_hexFunction · 0.85
payment_ignored_reqFunction · 0.85
json_add_boolFunction · 0.85
json_add_amount_msatFunction · 0.85
json_add_u32Function · 0.85

Tested by

no test coverage detected