MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_fundchannel

Function json_fundchannel

plugins/spender/fundchannel.c:36–116  ·  view source on GitHub ↗

Thin wrapper aroud multifundchannel. */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_add_tokFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
command_failFunction · 0.50
json_add_stringFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected