| 69 | } |
| 70 | |
| 71 | struct amount_msat flow_spend(const struct flow *flow) |
| 72 | { |
| 73 | const size_t pathlen = tal_count(flow->path); |
| 74 | struct amount_msat spend = flow->delivers; |
| 75 | |
| 76 | for (int i = (int)pathlen - 1; i >= 0; i--) { |
| 77 | const struct half_chan *h = flow_edge(flow, i); |
| 78 | if (!amount_msat_add_fee(&spend, h->base_fee, |
| 79 | h->proportional_fee)) { |
| 80 | child_err("Could not add fee %u/%u to amount %s in %i/%zu", |
| 81 | h->base_fee, h->proportional_fee, |
| 82 | fmt_amount_msat(tmpctx, spend), |
| 83 | i, pathlen); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | return spend; |
| 88 | } |
| 89 | |
| 90 | struct amount_msat flow_fee(const struct flow *flow) |
| 91 | { |
no test coverage detected