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

Function json_splicein

plugins/spender/splice.c:2219–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2217}
2218
2219static struct command_result *
2220json_splicein(struct command *cmd, const char *buf, const jsmntok_t *params)
2221{
2222 struct out_req *req;
2223 const char *channel, *amount;
2224 struct splice_cmd *splice_cmd;
2225 char *script;
2226
2227 if (!param(cmd, buf, params,
2228 p_req("channel", param_string, &channel),
2229 p_req("amount", param_string, &amount),
2230 NULL))
2231 return command_param_failed();
2232
2233 script = tal_fmt(NULL,
2234 "wallet -> %s + fee; %s -> %s",
2235 amount, amount, channel);
2236
2237 splice_cmd = tal(cmd, struct splice_cmd);
2238
2239 splice_cmd->cmd = cmd;
2240 splice_cmd->script = tal_steal(splice_cmd, script);
2241 splice_cmd->psbt = create_psbt(splice_cmd, 0, 0, 0);
2242 splice_cmd->dryrun = false;
2243 splice_cmd->wetrun = false;
2244 splice_cmd->feerate_per_kw = 0;
2245 splice_cmd->force_feerate = false;
2246 splice_cmd->wallet_inputs_to_signed = 0;
2247 splice_cmd->fee_calculated = false;
2248 splice_cmd->initial_funds = AMOUNT_SAT(0);
2249 splice_cmd->emergency_sat = AMOUNT_SAT(0);
2250 splice_cmd->debug_log = NULL;
2251 splice_cmd->debug_counter = 0;
2252 splice_cmd->needed_funds = AMOUNT_SAT(0);
2253 memset(&splice_cmd->final_txid, 0, sizeof(splice_cmd->final_txid));
2254
2255 req = jsonrpc_request_start(cmd, "listpeerchannels",
2256 listpeerchannels_get_result,
2257 splice_error, splice_cmd);
2258
2259 return send_outreq(req);
2260}
2261
2262static struct command_result *
2263json_spliceout(struct command *cmd, const char *buf, const jsmntok_t *params)

Callers

nothing calls this directly

Calls 4

create_psbtFunction · 0.85
paramFunction · 0.50
command_param_failedFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected