| 1422 | } |
| 1423 | |
| 1424 | static struct command_result *json_askrene_age(struct command *cmd, |
| 1425 | const char *buffer, |
| 1426 | const jsmntok_t *params) |
| 1427 | { |
| 1428 | struct layer *layer; |
| 1429 | struct json_stream *response; |
| 1430 | u64 *cutoff; |
| 1431 | size_t num_removed; |
| 1432 | |
| 1433 | if (!param(cmd, buffer, params, |
| 1434 | p_req("layer", param_known_layer, &layer), |
| 1435 | p_req("cutoff", param_u64, &cutoff), |
| 1436 | NULL)) |
| 1437 | return command_param_failed(); |
| 1438 | plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__, |
| 1439 | json_tok_full_len(params), json_tok_full(buffer, params)); |
| 1440 | |
| 1441 | num_removed = layer_trim_constraints(layer, *cutoff); |
| 1442 | |
| 1443 | response = jsonrpc_stream_success(cmd); |
| 1444 | json_add_string(response, "layer", layer_name(layer)); |
| 1445 | json_add_u64(response, "num_removed", num_removed); |
| 1446 | return command_finished(cmd, response); |
| 1447 | } |
| 1448 | |
| 1449 | static const struct plugin_command commands[] = { |
| 1450 | { |
nothing calls this directly
no test coverage detected