| 864 | } |
| 865 | |
| 866 | struct command_result *param_extra_tlvs(struct command *cmd, const char *name, |
| 867 | const char *buffer, |
| 868 | const jsmntok_t *tok, |
| 869 | struct tlv_field **fields) |
| 870 | { |
| 871 | size_t i; |
| 872 | const jsmntok_t *curr; |
| 873 | struct tlv_field *f, *temp; |
| 874 | |
| 875 | if (tok->type != JSMN_OBJECT) { |
| 876 | return command_fail( |
| 877 | cmd, JSONRPC2_INVALID_PARAMS, |
| 878 | "Could not decode the TLV object from %s: " |
| 879 | "\"%s\" is not a valid JSON object.", |
| 880 | name, json_strdup(tmpctx, buffer, tok)); |
| 881 | } |
| 882 | |
| 883 | temp = tal_arr(cmd, struct tlv_field, tok->size); |
| 884 | json_for_each_obj(i, curr, tok) { |
| 885 | f = &temp[i]; |
| 886 | if (!json_to_u64(buffer, curr, &f->numtype)) { |
| 887 | return command_fail( |
| 888 | cmd, JSONRPC2_INVALID_PARAMS, |
| 889 | "\"%s\" is not a valid numeric TLV type.", |
| 890 | json_strdup(tmpctx, buffer, curr)); |
| 891 | } |
| 892 | f->value = json_tok_bin_from_hex(temp, buffer, curr + 1); |
| 893 | |
| 894 | if (f->value == NULL) { |
| 895 | return command_fail( |
| 896 | cmd, JSONRPC2_INVALID_PARAMS, |
| 897 | "\"%s\" is not a valid hex encoded TLV value.", |
| 898 | json_strdup(tmpctx, buffer, curr)); |
| 899 | } |
| 900 | f->length = tal_bytelen(f->value); |
| 901 | f->meta = NULL; |
| 902 | } |
| 903 | *fields = temp; |
| 904 | return NULL; |
| 905 | } |
| 906 | |
| 907 | static struct command_result *param_routehint(struct command *cmd, |
| 908 | const char *name, |
nothing calls this directly
no test coverage detected