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

Function channel_apy_sum

plugins/bkpr/channelsapy.c:53–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53bool channel_apy_sum(struct channel_apy *sum_apy,
54 const struct channel_apy *entry)
55{
56 bool ok;
57 ok = amount_msat_accumulate(&sum_apy->routed_in,
58 entry->routed_in);
59 ok &= amount_msat_accumulate(&sum_apy->routed_out,
60 entry->routed_out);
61 ok &= amount_msat_accumulate(&sum_apy->fees_in,
62 entry->fees_in);
63 ok &= amount_msat_accumulate(&sum_apy->fees_out,
64 entry->fees_out);
65 ok &= amount_msat_accumulate(&sum_apy->push_in,
66 entry->push_in);
67 ok &= amount_msat_accumulate(&sum_apy->push_out,
68 entry->push_out);
69 ok &= amount_msat_accumulate(&sum_apy->lease_in,
70 entry->lease_in);
71 ok &= amount_msat_accumulate(&sum_apy->lease_out,
72 entry->lease_out);
73
74 ok &= amount_msat_accumulate(&sum_apy->our_start_bal,
75 entry->our_start_bal);
76
77 ok &= amount_msat_accumulate(&sum_apy->total_start_bal,
78 entry->total_start_bal);
79
80 if (sum_apy->start_blockheight > entry->start_blockheight)
81 sum_apy->start_blockheight = entry->start_blockheight;
82
83 if (sum_apy->end_blockheight < entry->end_blockheight)
84 sum_apy->end_blockheight = entry->end_blockheight;
85
86 return ok;
87}
88
89static struct account *search_account(struct account **accts, const char *acctname)
90{

Callers 1

getblockheight_doneFunction · 0.70

Calls 1

amount_msat_accumulateFunction · 0.85

Tested by

no test coverage detected