| 651 | } |
| 652 | |
| 653 | void squash_flows(const tal_t *ctx, struct route_query *rq, |
| 654 | struct flow ***flows) |
| 655 | { |
| 656 | asort(*flows, tal_count(*flows), cmppath_flows, NULL); |
| 657 | for (size_t i = 0; i < tal_count(*flows); i++) { |
| 658 | struct flow *flow = (*flows)[i]; |
| 659 | |
| 660 | /* same path? We merge */ |
| 661 | while (i + 1 < tal_count(*flows) && |
| 662 | cmppath_flows(&flow, &(*flows)[i+1], NULL) == 0) { |
| 663 | struct amount_msat combined, max = flow_max_deliverable(rq, flow); |
| 664 | |
| 665 | if (!amount_msat_add(&combined, flow->delivers, (*flows)[i+1]->delivers)) |
| 666 | abort(); |
| 667 | /* do we break any HTLC max limits */ |
| 668 | if (amount_msat_greater(combined, max)) |
| 669 | break; |
| 670 | flow->delivers = combined; |
| 671 | del_flow_from_arr(flows, i+1); |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | double flows_probability(const tal_t *ctx, struct route_query *rq, |
| 677 | struct flow ***flows) |
no test coverage detected