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

Function fail_in_htlc

lightningd/peer_htlcs.c:261–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261static void fail_in_htlc(struct htlc_in *hin,
262 const struct onionreply *failonion TAKES)
263{
264 struct failed_htlc *failed_htlc;
265 assert(!hin->preimage);
266
267 hin->failonion = dup_onionreply(hin, failonion);
268
269 /* We update state now to signal it's in progress, for persistence. */
270 htlc_in_update_state(hin->key.channel, hin, SENT_REMOVE_HTLC);
271 htlc_in_check(hin, __func__);
272
273 failed_htlc = mk_failed_htlc(tmpctx, hin, hin->failonion);
274
275 bool we_filled = false;
276 wallet_htlc_update(hin->key.channel->peer->ld->wallet,
277 hin->dbid, hin->hstate,
278 hin->preimage,
279 max_unsigned(hin->key.channel->next_index[LOCAL],
280 hin->key.channel->next_index[REMOTE]),
281 hin->badonion,
282 hin->failonion, NULL, &we_filled,
283 hin->key.id,
284 hin->key.channel,
285 REMOTE,
286 &hin->payment_hash,
287 hin->cltv_expiry,
288 hin->msat);
289
290 tell_channeld_htlc_failed(hin, failed_htlc);
291}
292
293/* Immediately fail HTLC with a BADONION code */
294static 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