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

Function fail_in_htlc

lightningd/peer_htlcs.c:224–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224static void fail_in_htlc(struct htlc_in *hin,
225 const struct onionreply *failonion TAKES)
226{
227 struct failed_htlc *failed_htlc;
228 assert(!hin->preimage);
229
230 hin->failonion = dup_onionreply(hin, failonion);
231
232 /* We update state now to signal it's in progress, for persistence. */
233 htlc_in_update_state(hin->key.channel, hin, SENT_REMOVE_HTLC);
234 htlc_in_check(hin, __func__);
235
236 failed_htlc = mk_failed_htlc(tmpctx, hin, hin->failonion);
237
238 bool we_filled = false;
239 wallet_htlc_update(hin->key.channel->peer->ld->wallet,
240 hin->dbid, hin->hstate,
241 hin->preimage,
242 max_unsigned(hin->key.channel->next_index[LOCAL],
243 hin->key.channel->next_index[REMOTE]),
244 hin->badonion,
245 hin->failonion, NULL, &we_filled,
246 hin->key.id,
247 hin->key.channel,
248 REMOTE,
249 &hin->payment_hash,
250 hin->cltv_expiry,
251 hin->msat);
252
253 tell_channeld_htlc_failed(hin, failed_htlc);
254}
255
256/* Immediately fail HTLC with a BADONION code */
257static void local_fail_in_htlc_badonion(struct htlc_in *hin,

Callers 5

local_fail_in_htlcFunction · 0.85
fail_out_htlcFunction · 0.85
rcvd_htlc_replyFunction · 0.85
onchain_failed_our_htlcFunction · 0.85

Calls 6

dup_onionreplyFunction · 0.85
htlc_in_update_stateFunction · 0.85
mk_failed_htlcFunction · 0.85
wallet_htlc_updateFunction · 0.85
htlc_in_checkFunction · 0.70

Tested by

no test coverage detected