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

Function payment_exclude_most_expensive

plugins/libplugin-pay.c:396–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396static void payment_exclude_most_expensive(struct payment *p)
397{
398 struct route_hop *e = &p->route[0];
399 struct amount_msat fee, worst = AMOUNT_MSAT(0);
400
401 for (size_t i = 0; i < tal_count(p->route)-1; i++) {
402 if (!amount_msat_sub(&fee, p->route[i].amount, p->route[i+1].amount))
403 paymod_err(p, "Negative fee in a route.");
404
405 if (amount_msat_greater_eq(fee, worst)) {
406 e = &p->route[i];
407 worst = fee;
408 }
409 }
410 channel_hints_update(p, e->scid, e->direction, false, false,
411 NULL, NULL);
412}
413
414static void payment_exclude_longest_delay(struct payment *p)
415{

Callers 1

payment_getrouteFunction · 0.85

Calls 4

amount_msat_subFunction · 0.85
paymod_errFunction · 0.85
amount_msat_greater_eqFunction · 0.85
channel_hints_updateFunction · 0.85

Tested by

no test coverage detected