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

Function json_askrene_bias_node

plugins/askrene/askrene.c:1347–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1345}
1346
1347static struct command_result *json_askrene_bias_node(struct command *cmd,
1348 const char *buffer,
1349 const jsmntok_t *params)
1350{
1351 struct layer *layer;
1352 struct node_id *node;
1353 struct json_stream *response;
1354 const char *description;
1355 s8 *bias;
1356 const struct node_bias *b;
1357 bool *relative;
1358 bool *out_dir;
1359 u64 timestamp;
1360
1361 if (!param(cmd, buffer, params,
1362 p_req("layer", param_known_layer, &layer),
1363 p_req("node", param_node_id, &node),
1364 p_req("direction", param_direction, &out_dir),
1365 p_req("bias", param_s8_hundred, &bias),
1366 p_opt("description", param_string, &description),
1367 p_opt_def("relative", param_bool, &relative, false),
1368 NULL))
1369 return command_param_failed();
1370 plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1371 json_tok_full_len(params), json_tok_full(buffer, params));
1372
1373 timestamp = clock_time().ts.tv_sec;
1374 b = layer_set_node_bias(layer, node, description, *bias, *relative,
1375 *out_dir, timestamp);
1376 response = jsonrpc_stream_success(cmd);
1377 json_array_start(response, "node_biases");
1378 if (b)
1379 json_add_node_bias(response, NULL, b, layer);
1380 json_array_end(response);
1381 return command_finished(cmd, response);
1382}
1383
1384static struct command_result *json_askrene_disable_node(struct command *cmd,
1385 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