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. */
| 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. */ |
| 449 | static WARN_UNUSED_RESULT bool |
| 450 | payment_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 | |
| 465 | static struct channel_hint *payment_chanhints_get(struct payment *p, |
| 466 | struct route_hop *h) |
no test coverage detected