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

Function fail_in_htlc

lightningd/peer_htlcs.c:140–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void fail_in_htlc(struct htlc_in *hin,
141 const struct onionreply *failonion TAKES)
142{
143 struct failed_htlc *failed_htlc;
144 assert(!hin->preimage);
145
146 hin->failonion = dup_onionreply(hin, failonion);
147
148 /* We update state now to signal it's in progress, for persistence. */
149 htlc_in_update_state(hin->key.channel, hin, SENT_REMOVE_HTLC);
150 htlc_in_check(hin, __func__);
151
152#if EXPERIMENTAL_FEATURES
153 /* In a blinded path, all failures become invalid_onion_blinding */
154 if (hin->blinding) {
155 failed_htlc = mk_failed_htlc_badonion(tmpctx, hin,
156 WIRE_INVALID_ONION_BLINDING);
157 } else
158#endif
159 failed_htlc = mk_failed_htlc(tmpctx, hin, hin->failonion);
160
161 bool we_filled = false;
162 wallet_htlc_update(hin->key.channel->peer->ld->wallet,
163 hin->dbid, hin->hstate,
164 hin->preimage,
165 max_unsigned(hin->key.channel->next_index[LOCAL],
166 hin->key.channel->next_index[REMOTE]),
167 hin->badonion,
168 hin->failonion, NULL, &we_filled);
169
170 tell_channeld_htlc_failed(hin, failed_htlc);
171}
172
173/* Immediately fail HTLC with a BADONION code */
174static 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 7

dup_onionreplyFunction · 0.85
htlc_in_update_stateFunction · 0.85
htlc_in_checkFunction · 0.85
mk_failed_htlc_badonionFunction · 0.85
mk_failed_htlcFunction · 0.85
wallet_htlc_updateFunction · 0.85

Tested by

no test coverage detected