| 977 | } |
| 978 | |
| 979 | struct command_result *param_route_exclusion(struct command *cmd, |
| 980 | const char *name, const char *buffer, const jsmntok_t *tok, |
| 981 | struct route_exclusion **re) |
| 982 | { |
| 983 | *re = tal(cmd, struct route_exclusion); |
| 984 | struct short_channel_id_dir *chan_id = |
| 985 | tal(tmpctx, struct short_channel_id_dir); |
| 986 | if (!short_channel_id_dir_from_str(buffer + tok->start, |
| 987 | tok->end - tok->start, |
| 988 | chan_id)) { |
| 989 | struct node_id *node_id = tal(tmpctx, struct node_id); |
| 990 | |
| 991 | if (!json_to_node_id(buffer, tok, node_id)) |
| 992 | return command_fail_badparam(cmd, "exclude", |
| 993 | buffer, tok, |
| 994 | "should be short_channel_id_dir or node_id"); |
| 995 | |
| 996 | (*re)->type = EXCLUDE_NODE; |
| 997 | (*re)->u.node_id = *node_id; |
| 998 | } else { |
| 999 | (*re)->type = EXCLUDE_CHANNEL; |
| 1000 | (*re)->u.chan_id = *chan_id; |
| 1001 | } |
| 1002 | |
| 1003 | return NULL; |
| 1004 | } |
| 1005 | |
| 1006 | struct command_result * |
| 1007 | param_route_exclusion_array(struct command *cmd, const char *name, |
no test coverage detected