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

Function payment_constraints_update

plugins/libplugin-pay.c:477–491  ·  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

475/* Update the constraints by subtracting the delta_fee and delta_cltv if the
476 * result is positive. Returns whether or not the update has been applied. */
477static WARN_UNUSED_RESULT bool
478payment_constraints_update(struct payment_constraints *cons,
479 const struct amount_msat delta_fee,
480 const u32 delta_cltv)
481{
482 if (delta_cltv > cons->cltv_budget)
483 return false;
484
485 /* amount_msat_sub performs a check before actually subtracting. */
486 if (!amount_msat_deduct(&cons->fee_budget, delta_fee))
487 return false;
488
489 cons->cltv_budget -= delta_cltv;
490 return true;
491}
492
493static struct channel_hint *payment_chanhints_get(struct payment *p,
494 struct route_hop *h)

Callers 1

payment_getrouteFunction · 0.85

Calls 1

amount_msat_deductFunction · 0.85

Tested by

no test coverage detected