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

Function flow_spend

plugins/askrene/child/flow.c:71–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71struct 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
90struct amount_msat flow_fee(const struct flow *flow)
91{

Callers 1

flow_feeFunction · 0.70

Calls 4

amount_msat_add_feeFunction · 0.85
child_errFunction · 0.85
flow_edgeFunction · 0.70
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected