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

Function payment_continue

plugins/libplugin-pay.c:2360–2410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2358}
2359
2360struct command_result *payment_continue(struct payment *p)
2361{
2362 struct payment_modifier *mod;
2363 void *moddata;
2364
2365 trace_span_start("payment_continue", p);
2366 /* If we are in the middle of calling the modifiers, continue calling
2367 * them, otherwise we can continue with the payment state-machine. */
2368 p->current_modifier++;
2369 mod = p->modifiers[p->current_modifier];
2370
2371 if (mod != NULL) {
2372 char *str = tal_fmt(tmpctx, "%d", p->current_modifier);
2373 trace_span_tag(p, "modifier", str);
2374 trace_span_end(p);
2375 /* There is another modifier, so call it. */
2376 moddata = p->modifier_data[p->current_modifier];
2377 return mod->post_step_cb(moddata, p);
2378 } else {
2379 /* There are no more modifiers, so reset the call chain and
2380 * proceed to the next state. */
2381 p->current_modifier = -1;
2382 trace_span_tag(p, "step", payment_step_str[p->step]);
2383 trace_span_end(p);
2384 switch (p->step) {
2385 case PAYMENT_STEP_INITIALIZED:
2386 case PAYMENT_STEP_RETRY_GETROUTE:
2387 return payment_getlocalmods(p);
2388
2389 case PAYMENT_STEP_GOT_ROUTE:
2390 return payment_compute_onion_payloads(p);
2391
2392 case PAYMENT_STEP_ONION_PAYLOAD:
2393 return payment_sendonion(p);
2394
2395 case PAYMENT_STEP_SUCCESS:
2396 case PAYMENT_STEP_FAILED:
2397 return payment_finished(p);
2398
2399 case PAYMENT_STEP_RETRY:
2400 case PAYMENT_STEP_SPLIT:
2401 /* Do nothing, we'll get pinged by a child succeeding
2402 * or failing. */
2403 return command_still_pending(payment_cmd(p));
2404 }
2405 }
2406 trace_span_end(p);
2407 /* We should never get here, it'd mean one of the state machine called
2408 * `payment_continue` after the final state. */
2409 abort();
2410}
2411
2412struct command_result *payment_abort(struct payment *p, enum jsonrpc_errcode code, const char *fmt, ...) {
2413 va_list ap;

Callers 15

payment_getrouteFunction · 0.70
payment_failFunction · 0.70
retry_step_cbFunction · 0.70
local_channel_hints_cbFunction · 0.70
routehint_step_cbFunction · 0.70

Calls 9

trace_span_tagFunction · 0.85
trace_span_endFunction · 0.85
payment_getlocalmodsFunction · 0.85
payment_sendonionFunction · 0.85
payment_finishedFunction · 0.85
payment_cmdFunction · 0.85
abortFunction · 0.85
command_still_pendingFunction · 0.70

Tested by

no test coverage detected