MCPcopy Create free account
hub / github.com/ElementsProject/lightning / flow_spend

Function flow_spend

plugins/renepay/flow.c:353–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353bool 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
370function_fail:
371 return false;
372}
373
374bool flow_fee(struct amount_msat *ret, struct flow *flow)
375{

Callers 1

flow_feeFunction · 0.70

Calls 2

amount_msat_add_feeFunction · 0.85
flow_edgeFunction · 0.70

Tested by

no test coverage detected