| 372 | } |
| 373 | |
| 374 | bool flow_fee(struct amount_msat *ret, struct flow *flow) |
| 375 | { |
| 376 | assert(ret); |
| 377 | assert(flow); |
| 378 | struct amount_msat fee; |
| 379 | struct amount_msat spend; |
| 380 | if (!flow_spend(&spend, flow)) |
| 381 | goto function_fail; |
| 382 | if (!amount_msat_sub(&fee, spend, flow->amount)) |
| 383 | goto function_fail; |
| 384 | |
| 385 | *ret = fee; |
| 386 | return true; |
| 387 | |
| 388 | function_fail: |
| 389 | return false; |
| 390 | } |
| 391 | |
| 392 | bool flowset_fee(struct amount_msat *ret, struct flow **flows) |
| 393 | { |