| 351 | } |
| 352 | |
| 353 | bool flow_spend(struct amount_msat *ret, struct flow *flow) |
| 354 | { |
| 355 | assert(ret); |
| 356 | assert(flow); |
| 357 | const size_t pathlen = tal_count(flow->path); |
| 358 | struct amount_msat spend = flow->amount; |
| 359 | |
| 360 | for (int i = (int)pathlen - 2; i >= 0; i--) { |
| 361 | const struct half_chan *h = flow_edge(flow, i + 1); |
| 362 | if (!amount_msat_add_fee(&spend, h->base_fee, |
| 363 | h->proportional_fee)) |
| 364 | goto function_fail; |
| 365 | } |
| 366 | |
| 367 | *ret = spend; |
| 368 | return true; |
| 369 | |
| 370 | function_fail: |
| 371 | return false; |
| 372 | } |
| 373 | |
| 374 | bool flow_fee(struct amount_msat *ret, struct flow *flow) |
| 375 | { |
no test coverage detected