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

Function payment_continue

plugins/renepay/mods.c:27–72  ·  view source on GitHub ↗

Advance the payment virtual machine */

Source from the content-addressed store, hash-verified

25
26/* Advance the payment virtual machine */
27struct command_result *payment_continue(struct payment *payment)
28{
29 assert(payment->exec_state != INVALID_STATE);
30 void *op = payment_virtual_program[payment->exec_state++];
31
32 if (op == OP_NULL) {
33 plugin_err(pay_plugin->plugin,
34 "payment_continue reached the end of the virtual "
35 "machine execution.");
36 } else if (op == OP_CALL) {
37 const struct payment_modifier *mod =
38 (const struct payment_modifier *)
39 payment_virtual_program[payment->exec_state++];
40
41 if (mod == NULL)
42 plugin_err(pay_plugin->plugin,
43 "payment_continue expected payment_modifier "
44 "but NULL found");
45
46 plugin_log(pay_plugin->plugin, LOG_TRACE, "Calling modifier %s",
47 mod->name);
48 return mod->step_cb(payment);
49 } else if (op == OP_IF) {
50 const struct payment_condition *cond =
51 (const struct payment_condition *)
52 payment_virtual_program[payment->exec_state++];
53
54 if (cond == NULL)
55 plugin_err(pay_plugin->plugin,
56 "payment_continue expected pointer to "
57 "condition but NULL found");
58
59 plugin_log(pay_plugin->plugin, LOG_TRACE,
60 "Calling payment condition %s", cond->name);
61
62 const u64 position_iftrue =
63 (intptr_t)payment_virtual_program[payment->exec_state++];
64
65 if (cond->condition_cb(payment))
66 payment->exec_state = position_iftrue;
67
68 return payment_continue(payment);
69 }
70 plugin_err(pay_plugin->plugin, "payment_continue op code not defined");
71 return NULL;
72}
73
74
75/* Generic handler for RPC failures that should end up failing the payment. */

Callers 15

payment_startFunction · 0.70
previoussuccess_doneFunction · 0.70
initial_sanity_checks_cbFunction · 0.70
selfpay_cbFunction · 0.70
getmychannels_doneFunction · 0.70
refreshgossmap_cbFunction · 0.70
routehints_doneFunction · 0.70
routehints_cbFunction · 0.70
blindedhints_cbFunction · 0.70
compute_routes_cbFunction · 0.70
waitblockheight_doneFunction · 0.70
sleep_doneFunction · 0.70

Calls 2

plugin_errFunction · 0.50
plugin_logFunction · 0.50

Tested by

no test coverage detected