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

Function param_chanhints

lightningd/invoice.c:1079–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1077}
1078
1079static struct command_result *param_chanhints(struct command *cmd,
1080 const char *name,
1081 const char *buffer,
1082 const jsmntok_t *tok,
1083 struct chanhints **chanhints)
1084{
1085 bool boolhint;
1086
1087 *chanhints = tal(cmd, struct chanhints);
1088
1089 /* Could be simply "true" or "false" */
1090 if (json_to_bool(buffer, tok, &boolhint)) {
1091 (*chanhints)->expose_all_private = boolhint;
1092 (*chanhints)->hints = NULL;
1093 return NULL;
1094 }
1095
1096 (*chanhints)->expose_all_private = true;
1097 /* Could be a single short_channel_id or an array */
1098 if (tok->type == JSMN_ARRAY) {
1099 size_t i;
1100 const jsmntok_t *t;
1101
1102 (*chanhints)->hints
1103 = tal_arr(*chanhints, struct short_channel_id,
1104 tok->size);
1105 json_for_each_arr(i, t, tok) {
1106 if (!json_to_short_channel_id(buffer, t,
1107 &(*chanhints)->hints[i])) {
1108 return command_fail_badparam(cmd, name, buffer, t,
1109 "should be a short channel id");
1110 }
1111 }
1112 return NULL;
1113 }
1114
1115 /* Otherwise should be a short_channel_id */
1116 return param_short_channel_id(cmd, name, buffer, tok,
1117 &(*chanhints)->hints);
1118}
1119
1120static struct command_result *param_preimage(struct command *cmd,
1121 const char *name,

Callers

nothing calls this directly

Calls 4

command_fail_badparamFunction · 0.85
json_to_boolFunction · 0.50
json_to_short_channel_idFunction · 0.50
param_short_channel_idFunction · 0.50

Tested by

no test coverage detected