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

Function json_multifundchannel

plugins/spender/multifundchannel.c:1979–2025  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1977Command Entry Point
1978-----------------------------------------------------------------------------*/
1979static struct command_result *
1980json_multifundchannel(struct command *cmd,
1981 const char *buf,
1982 const jsmntok_t *params)
1983{
1984 struct multifundchannel_destination *dests;
1985 u32 *minconf;
1986 u32 *minchannels;
1987
1988 struct multifundchannel_command *mfc;
1989
1990 mfc = tal(cmd, struct multifundchannel_command);
1991 if (!param(cmd, buf, params,
1992 p_req("destinations", param_destinations_array, &dests),
1993 p_opt("feerate", param_string, &mfc->feerate_str),
1994 p_opt_def("minconf", param_number, &minconf, 1),
1995 p_opt("utxos", param_utxos_str, &mfc->utxos_str),
1996 p_opt("minchannels", param_positive_number, &minchannels),
1997 p_opt("commitment_feerate", param_string, &mfc->cmtmt_feerate_str),
1998 NULL))
1999 return command_param_failed();
2000
2001 /* Should exist; it would only nonexist if it were a notification. */
2002 assert(cmd->id);
2003
2004 mfc->id = ++mfc_id;
2005 mfc->cmd = cmd;
2006
2007 /* Steal destinations array, and set up mfc pointers */
2008 mfc->destinations = tal_steal(mfc, dests);
2009 for (size_t i = 0; i < tal_count(mfc->destinations); i++)
2010 mfc->destinations[i].mfc = mfc;
2011
2012 mfc->minconf = *minconf;
2013 /* Default is that all must succeed. */
2014 mfc->minchannels = minchannels ? *minchannels : tal_count(mfc->destinations);
2015 mfc->removeds = tal_arr(mfc, struct multifundchannel_removed, 0);
2016 mfc->psbt = NULL;
2017 mfc->txid = NULL;
2018 mfc->final_tx = NULL;
2019 mfc->final_txid = NULL;
2020
2021 mfc->sigs_collected = false;
2022
2023 perform_multiconnect(mfc);
2024 return command_still_pending(mfc->cmd);
2025}
2026
2027const struct plugin_command multifundchannel_commands[] = {
2028 {

Callers

nothing calls this directly

Calls 4

perform_multiconnectFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
command_still_pendingFunction · 0.50

Tested by

no test coverage detected