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