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

Function param_chanhints

lightningd/invoice.c:1056–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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