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

Function param_chanhints

lightningd/invoice.c:1054–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1052}
1053
1054static struct command_result *param_chanhints(struct command *cmd,
1055 const char *name,
1056 const char *buffer,
1057 const jsmntok_t *tok,
1058 struct chanhints **chanhints)
1059{
1060 bool boolhint;
1061
1062 *chanhints = tal(cmd, struct chanhints);
1063
1064 /* Could be simply "true" or "false" */
1065 if (json_to_bool(buffer, tok, &boolhint)) {
1066 (*chanhints)->expose_all_private = boolhint;
1067 (*chanhints)->hints = NULL;
1068 return NULL;
1069 }
1070
1071 (*chanhints)->expose_all_private = true;
1072 /* Could be a single short_channel_id or an array */
1073 if (tok->type == JSMN_ARRAY) {
1074 size_t i;
1075 const jsmntok_t *t;
1076
1077 (*chanhints)->hints
1078 = tal_arr(*chanhints, struct short_channel_id,
1079 tok->size);
1080 json_for_each_arr(i, t, tok) {
1081 if (!json_to_short_channel_id(buffer, t,
1082 &(*chanhints)->hints[i])) {
1083 return command_fail_badparam(cmd, name, buffer, t,
1084 "should be a short channel id");
1085 }
1086 }
1087 return NULL;
1088 }
1089
1090 /* Otherwise should be a short_channel_id */
1091 return param_short_channel_id(cmd, name, buffer, tok,
1092 &(*chanhints)->hints);
1093}
1094
1095static struct command_result *param_preimage(struct command *cmd,
1096 const char *name,

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected