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

Function param_direction

plugins/askrene/askrene.c:68–94  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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