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

Function injectpaymentonion_failed

plugins/xpay/xpay.c:1218–1250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1216}
1217
1218static struct command_result *injectpaymentonion_failed(struct command *aux_cmd,
1219 const char *method,
1220 const char *buf,
1221 const jsmntok_t *error,
1222 struct attempt *attempt)
1223{
1224 struct payment *payment = attempt->payment;
1225 struct amount_msat amount = attempt->amount;
1226
1227 payment->num_failures++;
1228
1229 /* Move from current_attempts to past_attempts */
1230 list_del_from(&payment->current_attempts, &attempt->list);
1231 list_add(&payment->past_attempts, &attempt->list);
1232
1233 /* We're no longer using this path: submit request to release it */
1234 unreserve_path(aux_cmd, attempt);
1235
1236 /* Once reserve is removed, we can tell lightningd what we
1237 * learned. Might fail payment! */
1238 update_knowledge_from_error(aux_cmd, buf, error, attempt);
1239
1240 /* If xpay is done, return now */
1241 if (!payment->cmd)
1242 return command_still_pending(aux_cmd);
1243
1244 /* If we're not waiting for getroutes, kick one off */
1245 if (amount_msat_is_zero(payment->amount_being_routed))
1246 return getroutes_for(aux_cmd, payment, amount);
1247
1248 /* Wait for getroutes to finish */
1249 return command_still_pending(aux_cmd);
1250}
1251
1252static struct amount_msat total_being_delivered(const struct payment *payment)
1253{

Callers

nothing calls this directly

Calls 6

list_del_fromFunction · 0.85
unreserve_pathFunction · 0.85
amount_msat_is_zeroFunction · 0.85
getroutes_forFunction · 0.85
command_still_pendingFunction · 0.50

Tested by

no test coverage detected