| 122 | } |
| 123 | |
| 124 | bool create_flow_reservations_verify(const struct route_query *rq, |
| 125 | struct reserve_hop **reservations, |
| 126 | const struct flow *flow) |
| 127 | { |
| 128 | struct amount_msat msat; |
| 129 | msat = flow->delivers; |
| 130 | for (int i = tal_count(flow->path) - 1; i >= 0; i--) { |
| 131 | struct amount_msat known_min, known_max; |
| 132 | const struct half_chan *h = flow_edge(flow, i); |
| 133 | struct amount_msat amount_to_reserve = msat; |
| 134 | struct short_channel_id_dir scidd; |
| 135 | |
| 136 | get_scidd(rq->gossmap, flow, i, &scidd); |
| 137 | get_constraints(rq, flow->path[i], flow->dirs[i], &known_min, |
| 138 | &known_max); |
| 139 | if (amount_msat_greater(amount_to_reserve, known_max)) |
| 140 | return false; |
| 141 | |
| 142 | if (!amount_msat_add_fee(&msat, h->base_fee, |
| 143 | h->proportional_fee)) |
| 144 | abort(); |
| 145 | } |
| 146 | create_flow_reservations(rq, reservations, flow); |
| 147 | return true; |
| 148 | } |
| 149 | |
| 150 | /* We use an fp16_t approximatin for htlc_max/min: this gets the exact value. */ |
| 151 | static struct amount_msat get_chan_htlc_max(const struct route_query *rq, |
no test coverage detected