Thin wrapper aroud multifundchannel. */
| 39 | |
| 40 | /* Thin wrapper aroud multifundchannel. */ |
| 41 | static struct command_result * |
| 42 | json_fundchannel(struct command *cmd, |
| 43 | const char *buf, |
| 44 | const jsmntok_t *params) |
| 45 | { |
| 46 | const char *id; |
| 47 | const jsmntok_t *amount; |
| 48 | const jsmntok_t *feerate; |
| 49 | const jsmntok_t *announce; |
| 50 | const jsmntok_t *minconf; |
| 51 | const jsmntok_t *utxos; |
| 52 | const jsmntok_t *push_msat; |
| 53 | const jsmntok_t *close_to; |
| 54 | const jsmntok_t *request_amt; |
| 55 | const jsmntok_t *compact_lease; |
| 56 | const jsmntok_t *mindepth; |
| 57 | const jsmntok_t *reserve; |
| 58 | |
| 59 | struct out_req *req; |
| 60 | |
| 61 | if (!param(cmd, buf, params, |
| 62 | p_req("id", param_string, &id), |
| 63 | p_req("amount", param_tok, &amount), |
| 64 | p_opt("feerate", param_tok, &feerate), |
| 65 | p_opt("announce", param_tok, &announce), |
| 66 | p_opt("minconf", param_tok, &minconf), |
| 67 | p_opt("utxos", param_tok, &utxos), |
| 68 | p_opt("push_msat", param_tok, &push_msat), |
| 69 | p_opt("close_to", param_tok, &close_to), |
| 70 | p_opt("request_amt", param_tok, &request_amt), |
| 71 | p_opt("compact_lease", param_tok, &compact_lease), |
| 72 | p_opt("mindepth", param_tok, &mindepth), |
| 73 | p_opt("reserve", param_tok, &reserve), |
| 74 | NULL)) |
| 75 | return command_param_failed(); |
| 76 | |
| 77 | if (request_amt && !compact_lease) |
| 78 | return command_fail(cmd, JSONRPC2_INVALID_PARAMS, |
| 79 | "Must pass in 'compact_lease' if requesting" |
| 80 | " funds from peer"); |
| 81 | |
| 82 | req = jsonrpc_request_start(cmd->plugin, cmd, "multifundchannel", |
| 83 | &fundchannel_get_result, &forward_error, |
| 84 | NULL); |
| 85 | |
| 86 | json_array_start(req->js, "destinations"); |
| 87 | json_object_start(req->js, NULL); |
| 88 | json_add_string(req->js, "id", id); |
| 89 | json_add_tok(req->js, "amount", amount, buf); |
| 90 | if (announce) |
| 91 | json_add_tok(req->js, "announce", announce, buf); |
| 92 | if (push_msat) |
| 93 | json_add_tok(req->js, "push_msat", push_msat, buf); |
| 94 | if (close_to) |
| 95 | json_add_tok(req->js, "close_to", close_to, buf); |
| 96 | if (request_amt) { |
| 97 | json_add_tok(req->js, "request_amt", request_amt, buf); |
| 98 | json_add_tok(req->js, "compact_lease", compact_lease, buf); |
nothing calls this directly
no test coverage detected