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

Function json_askrene_bias_node

plugins/askrene/askrene.c:1283–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1281}
1282
1283static struct command_result *json_askrene_bias_node(struct command *cmd,
1284 const char *buffer,
1285 const jsmntok_t *params)
1286{
1287 struct layer *layer;
1288 struct node_id *node;
1289 struct json_stream *response;
1290 const char *description;
1291 s8 *bias;
1292 const struct node_bias *b;
1293 bool *relative;
1294 bool *out_dir;
1295 u64 timestamp;
1296
1297 if (!param(cmd, buffer, params,
1298 p_req("layer", param_known_layer, &layer),
1299 p_req("node", param_node_id, &node),
1300 p_req("direction", param_direction, &out_dir),
1301 p_req("bias", param_s8_hundred, &bias),
1302 p_opt("description", param_string, &description),
1303 p_opt_def("relative", param_bool, &relative, false),
1304 NULL))
1305 return command_param_failed();
1306 plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1307 json_tok_full_len(params), json_tok_full(buffer, params));
1308
1309 timestamp = clock_time().ts.tv_sec;
1310 b = layer_set_node_bias(layer, node, description, *bias, *relative,
1311 *out_dir, timestamp);
1312 response = jsonrpc_stream_success(cmd);
1313 json_array_start(response, "node_biases");
1314 if (b)
1315 json_add_node_bias(response, NULL, b, layer);
1316 json_array_end(response);
1317 return command_finished(cmd, response);
1318}
1319
1320static struct command_result *json_askrene_disable_node(struct command *cmd,
1321 const char *buffer,

Callers

nothing calls this directly

Calls 12

clock_timeFunction · 0.85
layer_set_node_biasFunction · 0.85
json_array_startFunction · 0.85
json_add_node_biasFunction · 0.85
json_array_endFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
plugin_logFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
jsonrpc_stream_successFunction · 0.50
command_finishedFunction · 0.50

Tested by

no test coverage detected