| 657 | } |
| 658 | |
| 659 | struct command_result *param_secrets_array(struct command *cmd, |
| 660 | const char *name, const char *buffer, |
| 661 | const jsmntok_t *tok, |
| 662 | struct secret **secrets) |
| 663 | { |
| 664 | size_t i; |
| 665 | const jsmntok_t *s; |
| 666 | struct secret secret; |
| 667 | |
| 668 | if (tok->type != JSMN_ARRAY) { |
| 669 | return command_fail_badparam(cmd, name, buffer, tok, |
| 670 | "should be an array of secrets"); |
| 671 | } |
| 672 | |
| 673 | *secrets = tal_arr(cmd, struct secret, 0); |
| 674 | json_for_each_arr(i, s, tok) { |
| 675 | if (!hex_decode(buffer + s->start, s->end - s->start, &secret, |
| 676 | sizeof(secret))) |
| 677 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 678 | "'%s[%zu]' should be a 32 byte hex " |
| 679 | "value, not '%.*s'", |
| 680 | name, i, s->end - s->start, |
| 681 | buffer + s->start); |
| 682 | |
| 683 | tal_arr_expand(secrets, secret); |
| 684 | } |
| 685 | return NULL; |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * segwit_addr_net_decode - Try to decode a Bech32 address and detect |
nothing calls this directly
no test coverage detected