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. */
| 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. */ |
| 477 | static WARN_UNUSED_RESULT bool |
| 478 | payment_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 | |
| 493 | static struct channel_hint *payment_chanhints_get(struct payment *p, |
| 494 | struct route_hop *h) |
no test coverage detected