| 428 | } |
| 429 | |
| 430 | static struct amount_msat payment_route_fee(struct payment *p) |
| 431 | { |
| 432 | struct amount_msat fee; |
| 433 | if (!amount_msat_sub(&fee, p->route[0].amount, p->amount)) { |
| 434 | paymod_log( |
| 435 | p, |
| 436 | LOG_BROKEN, |
| 437 | "gossipd returned a route with a negative fee: sending %s " |
| 438 | "to deliver %s", |
| 439 | type_to_string(tmpctx, struct amount_msat, |
| 440 | &p->route[0].amount), |
| 441 | type_to_string(tmpctx, struct amount_msat, &p->amount)); |
| 442 | abort(); |
| 443 | } |
| 444 | return fee; |
| 445 | } |
| 446 | |
| 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. */ |
no test coverage detected