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

Function json_list_income

plugins/bkpr/bookkeeper.c:193–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193static struct command_result *json_list_income(struct command *cmd,
194 const char *buf,
195 const jsmntok_t *params)
196{
197 struct json_stream *res;
198 struct income_event **evs;
199 bool *consolidate_fees;
200 u64 *start_time, *end_time;
201
202 if (!param(cmd, buf, params,
203 p_opt_def("consolidate_fees", param_bool,
204 &consolidate_fees, true),
205 p_opt_def("start_time", param_u64, &start_time, 0),
206 p_opt_def("end_time", param_u64, &end_time, SQLITE_MAX_UINT),
207 NULL))
208 return command_param_failed();
209
210 /* Ok, go find me some income events! */
211 db_begin_transaction(db);
212 evs = list_income_events(cmd, db, *start_time, *end_time,
213 *consolidate_fees);
214 db_commit_transaction(db);
215
216 res = jsonrpc_stream_success(cmd);
217
218 json_array_start(res, "income_events");
219 for (size_t i = 0; i < tal_count(evs); i++)
220 json_add_income_event(res, evs[i]);
221
222 json_array_end(res);
223 return command_finished(cmd, res);
224}
225
226static struct command_result *json_inspect(struct command *cmd,
227 const char *buf,

Callers

nothing calls this directly

Calls 9

list_income_eventsFunction · 0.85
json_add_income_eventFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
db_commit_transactionFunction · 0.50
jsonrpc_stream_successFunction · 0.50
json_array_startFunction · 0.50
json_array_endFunction · 0.50
command_finishedFunction · 0.50

Tested by

no test coverage detected