Valid, known layers */
| 93 | |
| 94 | /* Valid, known layers */ |
| 95 | static struct command_result *param_layer_names(struct command *cmd, |
| 96 | const char *name, |
| 97 | const char *buffer, |
| 98 | const jsmntok_t *tok, |
| 99 | const char ***arr) |
| 100 | { |
| 101 | size_t i; |
| 102 | const jsmntok_t *t; |
| 103 | |
| 104 | if (tok->type != JSMN_ARRAY) |
| 105 | return command_fail_badparam(cmd, name, buffer, tok, |
| 106 | "should be an array"); |
| 107 | |
| 108 | *arr = tal_arr(cmd, const char *, tok->size); |
| 109 | json_for_each_arr(i, t, tok) { |
| 110 | if (t->type != JSMN_STRING) |
| 111 | return command_fail_badparam(cmd, name, buffer, t, |
| 112 | "should be a string"); |
| 113 | (*arr)[i] = json_strdup(*arr, buffer, t); |
| 114 | |
| 115 | /* Must be a known layer name */ |
| 116 | if (streq((*arr)[i], "auto.localchans") |
| 117 | || streq((*arr)[i], "auto.sourcefree") |
| 118 | || streq((*arr)[i], "auto.include_fees")) |
| 119 | continue; |
| 120 | |
| 121 | if (streq((*arr)[i], "auto.no_mpp_support") |
| 122 | && command_deprecated_in_ok(cmd, "layers.auto.no_mpp_support", |
| 123 | "v26.06", "v27.03")) |
| 124 | continue; |
| 125 | |
| 126 | if (!find_layer(get_askrene(cmd->plugin), (*arr)[i])) { |
| 127 | return command_fail_badparam(cmd, name, buffer, t, |
| 128 | "unknown layer"); |
| 129 | } |
| 130 | } |
| 131 | return NULL; |
| 132 | } |
| 133 | |
| 134 | static struct command_result *param_known_layer(struct command *cmd, |
| 135 | const char *name, |
nothing calls this directly
no test coverage detected