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

Function param_direction

plugins/askrene/askrene.c:66–92  ·  view source on GitHub ↗

A direction, either "in" or "out", internally handled as a boolean. */

Source from the content-addressed store, hash-verified

64
65/* A direction, either "in" or "out", internally handled as a boolean. */
66static struct command_result *param_direction(struct command *cmd,
67 const char *name,
68 const char *buffer,
69 const jsmntok_t *tok,
70 bool **out_direction)
71{
72 const char *value;
73 struct command_result *ret =
74 param_string(cmd, name, buffer, tok, &value);
75 if (ret)
76 return ret;
77
78 *out_direction = tal(cmd, bool);
79 if (streq(value, "in"))
80 **out_direction = false;
81 else if (streq(value, "out"))
82 **out_direction = true;
83 else {
84 tal_free(value);
85 return command_fail_badparam(
86 cmd, name, buffer, tok,
87 "Expected either in or out values.");
88 }
89
90 tal_free(value);
91 return NULL;
92}
93
94/* Valid, known layers */
95static struct command_result *param_layer_names(struct command *cmd,

Callers

nothing calls this directly

Calls 3

param_stringFunction · 0.85
tal_freeFunction · 0.85
command_fail_badparamFunction · 0.50

Tested by

no test coverage detected