| 95 | } |
| 96 | |
| 97 | void create_flow_reservations(const struct route_query *rq, |
| 98 | struct reserve_hop **reservations, |
| 99 | const struct flow *flow) |
| 100 | { |
| 101 | struct amount_msat msat; |
| 102 | |
| 103 | msat = flow->delivers; |
| 104 | for (int i = tal_count(flow->path) - 1; i >= 0; i--) { |
| 105 | const struct half_chan *h = flow_edge(flow, i); |
| 106 | struct amount_msat amount_to_reserve; |
| 107 | struct short_channel_id_dir scidd; |
| 108 | |
| 109 | get_scidd(rq->gossmap, flow, i, &scidd); |
| 110 | |
| 111 | /* Reserve more for local channels if it reduces capacity */ |
| 112 | if (!amount_msat_add(&amount_to_reserve, msat, |
| 113 | get_additional_per_htlc_cost(rq, &scidd))) |
| 114 | abort(); |
| 115 | |
| 116 | add_reservation(reservations, rq, flow->path[i], &scidd, |
| 117 | amount_to_reserve); |
| 118 | if (!amount_msat_add_fee(&msat, |
| 119 | h->base_fee, h->proportional_fee)) |
| 120 | child_err("Adding fee to amount"); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | bool create_flow_reservations_verify(const struct route_query *rq, |
| 125 | struct reserve_hop **reservations, |
no test coverage detected