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

Function total_sent

plugins/xpay/xpay.c:430–447  ·  view source on GitHub ↗

We total up all attempts which succeeded in the past (if we're not * in slow mode, that's only the one which just succeeded), and then we * assume any others currently-in-flight will also succeed. */

Source from the content-addressed store, hash-verified

428 * in slow mode, that's only the one which just succeeded), and then we
429 * assume any others currently-in-flight will also succeed. */
430static struct amount_msat total_sent(const struct payment *payment)
431{
432 struct amount_msat total = AMOUNT_MSAT(0);
433 const struct attempt *i;
434
435 list_for_each(&payment->past_attempts, i, list) {
436 if (!i->preimage)
437 continue;
438 if (!amount_msat_accumulate(&total, initial_sent(i)))
439 abort();
440 }
441
442 list_for_each(&payment->current_attempts, i, list) {
443 if (!amount_msat_accumulate(&total, initial_sent(i)))
444 abort();
445 }
446 return total;
447}
448
449/* Should we finish command now? */
450static bool should_finish_command(const struct payment *payment)

Callers 1

payment_succeededFunction · 0.85

Calls 3

amount_msat_accumulateFunction · 0.85
initial_sentFunction · 0.85
abortFunction · 0.85

Tested by

no test coverage detected