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

Function json_multifundchannel

plugins/spender/multifundchannel.c:2028–2075  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Command Entry Point -----------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

2026Command Entry Point
2027-----------------------------------------------------------------------------*/
2028static struct command_result *
2029json_multifundchannel(struct command *cmd,
2030 const char *buf,
2031 const jsmntok_t *params)
2032{
2033 struct multifundchannel_destination *dests;
2034 u32 *minconf;
2035 u32 *minchannels;
2036
2037 struct multifundchannel_command *mfc;
2038
2039 mfc = tal(cmd, struct multifundchannel_command);
2040 if (!param(cmd, buf, params,
2041 p_req("destinations", param_destinations_array, &dests),
2042 p_opt("feerate", param_string, &mfc->feerate_str),
2043 p_opt_def("minconf", param_number, &minconf, 1),
2044 p_opt("utxos", param_utxos_str, &mfc->utxos_str),
2045 p_opt("minchannels", param_positive_number, &minchannels),
2046 p_opt("commitment_feerate", param_string, &mfc->cmtmt_feerate_str),
2047 NULL))
2048 return command_param_failed();
2049
2050 /* Should exist; it would only nonexist if it were a notification. */
2051 assert(cmd->id);
2052
2053 mfc->id = *cmd->id;
2054 mfc->cmd = cmd;
2055
2056 /* Steal destinations array, and set up mfc pointers */
2057 mfc->destinations = tal_steal(mfc, dests);
2058 for (size_t i = 0; i < tal_count(mfc->destinations); i++)
2059 mfc->destinations[i].mfc = mfc;
2060
2061 mfc->minconf = *minconf;
2062 /* Default is that all must succeed. */
2063 mfc->minchannels = minchannels ? *minchannels : tal_count(mfc->destinations);
2064 mfc->removeds = tal_arr(mfc, struct multifundchannel_removed, 0);
2065 mfc->psbt = NULL;
2066 mfc->change_scriptpubkey = NULL;
2067 mfc->txid = NULL;
2068 mfc->final_tx = NULL;
2069 mfc->final_txid = NULL;
2070
2071 mfc->sigs_collected = false;
2072
2073 perform_multifundchannel(mfc);
2074 return command_still_pending(mfc->cmd);
2075}
2076
2077const struct plugin_command multifundchannel_commands[] = {
2078 {

Callers

nothing calls this directly

Calls 4

perform_multifundchannelFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
command_still_pendingFunction · 0.50

Tested by

no test coverage detected