| 191 | } |
| 192 | |
| 193 | static 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 | |
| 226 | static struct command_result *json_inspect(struct command *cmd, |
| 227 | const char *buf, |
nothing calls this directly
no test coverage detected