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

Function list_income_events

plugins/bkpr/incomestmt.c:301–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301struct income_event **list_income_events(const tal_t *ctx,
302 const struct bkpr *bkpr,
303 struct command *cmd,
304 u64 start_time,
305 u64 end_time,
306 bool consolidate_fees)
307{
308 struct channel_event **channel_events;
309 struct chain_event **chain_events;
310 struct onchain_fee **onchain_fees;
311 struct income_event **evs;
312
313 channel_events = list_channel_events_timebox(ctx, bkpr, cmd,
314 start_time, end_time);
315 chain_events = list_chain_events_timebox(ctx, bkpr, cmd, start_time, end_time);
316
317 if (consolidate_fees) {
318 onchain_fees = find_consolidated_fees(ctx, bkpr,
319 start_time,
320 end_time);
321 } else
322 onchain_fees = list_chain_fees_timebox(ctx, bkpr,
323 start_time, end_time);
324
325 evs = tal_arr(ctx, struct income_event *, 0);
326
327 for (size_t i = 0, j = 0, k = 0;
328 i < tal_count(chain_events)
329 || j < tal_count(channel_events)
330 || k < tal_count(onchain_fees);
331 /* Incrementing happens inside loop */) {
332 struct channel_event *chan;
333 struct chain_event *chain;
334 struct onchain_fee *fee;
335 u64 lowest = 0;
336
337 if (i < tal_count(chain_events))
338 chain = chain_events[i];
339 else
340 chain = NULL;
341 if (j < tal_count(channel_events))
342 chan = channel_events[j];
343 else
344 chan = NULL;
345 if (k < tal_count(onchain_fees))
346 fee = onchain_fees[k];
347 else
348 fee = NULL;
349
350 if (chain)
351 lowest = chain->timestamp;
352
353 if (chan
354 && (lowest == 0 || lowest > chan->timestamp))
355 lowest = chan->timestamp;
356
357 if (fee
358 && (lowest == 0 || lowest > fee->timestamp))

Callers 4

do_bkpr_reportFunction · 0.70
do_dump_incomeFunction · 0.70
do_list_incomeFunction · 0.70
list_income_events_allFunction · 0.70

Calls 12

find_consolidated_feesFunction · 0.85
list_chain_fees_timeboxFunction · 0.85
maybe_chain_incomeFunction · 0.85
maybe_channel_incomeFunction · 0.85
amount_msat_is_zeroFunction · 0.85
find_rebalanceFunction · 0.85
paid_invoice_feeFunction · 0.85
rebalance_feeFunction · 0.85
onchainfee_to_incomeFunction · 0.85
find_accountFunction · 0.70

Tested by

no test coverage detected