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

Function create_flow_reservations_verify

plugins/askrene/child/refine.c:124–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124bool 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. */
151static struct amount_msat get_chan_htlc_max(const struct route_query *rq,

Callers 1

linear_routesFunction · 0.85

Calls 7

get_constraintsFunction · 0.85
amount_msat_greaterFunction · 0.85
amount_msat_add_feeFunction · 0.85
abortFunction · 0.85
create_flow_reservationsFunction · 0.85
flow_edgeFunction · 0.70
get_sciddFunction · 0.70

Tested by

no test coverage detected