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

Function payment_constraints_update

plugins/libplugin-pay.c:449–463  ·  view source on GitHub ↗

Update the constraints by subtracting the delta_fee and delta_cltv if the * result is positive. Returns whether or not the update has been applied. */

Source from the content-addressed store, hash-verified

447/* Update the constraints by subtracting the delta_fee and delta_cltv if the
448 * result is positive. Returns whether or not the update has been applied. */
449static WARN_UNUSED_RESULT bool
450payment_constraints_update(struct payment_constraints *cons,
451 const struct amount_msat delta_fee,
452 const u32 delta_cltv)
453{
454 if (delta_cltv > cons->cltv_budget)
455 return false;
456
457 /* amount_msat_sub performs a check before actually subtracting. */
458 if (!amount_msat_sub(&cons->fee_budget, cons->fee_budget, delta_fee))
459 return false;
460
461 cons->cltv_budget -= delta_cltv;
462 return true;
463}
464
465static struct channel_hint *payment_chanhints_get(struct payment *p,
466 struct route_hop *h)

Callers 1

payment_getrouteFunction · 0.85

Calls 1

amount_msat_subFunction · 0.85

Tested by

no test coverage detected