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

Function get_htlc_max

devtools/gossmap-compress.c:229–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229static u64 get_htlc_max(struct gossmap *gossmap,
230 const struct gossmap_chan *chan,
231 int dir)
232{
233 struct amount_msat msat, capacity_msat;
234
235 capacity_msat = gossmap_chan_get_capacity(gossmap, chan);
236 gossmap_chan_get_update_details(gossmap, chan, dir,
237 NULL, NULL, NULL, NULL, NULL, NULL, NULL, &msat);
238
239 /* Special value for the common case of "max_htlc == capacity" */
240 if (amount_msat_eq(msat, capacity_msat)) {
241 return 0;
242 }
243 /* Other common case: "max_htlc == 99% capacity" */
244 if (amount_msat_scale(&capacity_msat, capacity_msat, 0.99)
245 && amount_msat_eq(msat, capacity_msat)) {
246 return 1;
247 }
248 return msat.millisatoshis; /* Raw: compressed format */
249}
250
251static u64 get_basefee(struct gossmap *gossmap,
252 const struct gossmap_chan *chan,

Callers

nothing calls this directly

Calls 4

amount_msat_scaleFunction · 0.85
amount_msat_eqFunction · 0.50

Tested by

no test coverage detected