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

Function create_flow_reservations

plugins/askrene/child/refine.c:97–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void 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
124bool create_flow_reservations_verify(const struct route_query *rq,
125 struct reserve_hop **reservations,

Callers 3

increase_flowsFunction · 0.85
flows_probabilityFunction · 0.85

Calls 8

amount_msat_addFunction · 0.85
abortFunction · 0.85
amount_msat_add_feeFunction · 0.85
child_errFunction · 0.85
flow_edgeFunction · 0.70
get_sciddFunction · 0.70
add_reservationFunction · 0.70

Tested by

no test coverage detected