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

Function list_channel_events_timebox

plugins/bkpr/recorder.c:898–940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896}
897
898struct channel_event **list_channel_events_timebox(const tal_t *ctx,
899 struct db *db,
900 u64 start_time,
901 u64 end_time)
902
903{
904 struct db_stmt *stmt;
905 struct channel_event **results;
906
907 stmt = db_prepare_v2(db, SQL("SELECT"
908 " e.id"
909 ", e.account_id"
910 ", a.name"
911 ", e.tag"
912 ", e.credit"
913 ", e.debit"
914 ", e.fees"
915 ", e.currency"
916 ", e.payment_id"
917 ", e.part_id"
918 ", e.timestamp"
919 ", e.ev_desc"
920 ", e.rebalance_id"
921 " FROM channel_events e"
922 " LEFT OUTER JOIN accounts a"
923 " ON a.id = e.account_id"
924 " WHERE e.timestamp > ?"
925 " AND e.timestamp <= ?"
926 " ORDER BY e.timestamp, e.id;"));
927
928 db_bind_u64(stmt, 0, start_time);
929 db_bind_u64(stmt, 1, end_time);
930 db_query_prepared(stmt);
931
932 results = tal_arr(ctx, struct channel_event *, 0);
933 while (db_step(stmt)) {
934 struct channel_event *e = stmt2channel_event(results, stmt);
935 tal_arr_expand(&results, e);
936 }
937 tal_free(stmt);
938
939 return results;
940}
941
942struct channel_event **list_channel_events(const tal_t *ctx, struct db *db)
943{

Callers 3

list_channel_eventsFunction · 0.85
list_income_eventsFunction · 0.85
compute_channel_apysFunction · 0.85

Calls 5

db_bind_u64Function · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
stmt2channel_eventFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected