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

Function do_fail

plugins/spender/splice.c:174–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174static struct command_result *do_fail(struct command *cmd,
175 struct splice_cmd *splice_cmd,
176 enum jsonrpc_errcode code,
177 const char *str TAKES)
178{
179 struct out_req *req;
180 struct abort_pkg *abort_pkg;
181 size_t added;
182
183 /* If we encounter an error, wetrun is canceled */
184 splice_cmd->wetrun = false;
185
186 plugin_log(cmd->plugin, LOG_DBG,
187 "splice_error(psbt:%p, splice_cmd:%p, str: %s)",
188 splice_cmd->psbt, splice_cmd, str ?: "");
189
190 abort_pkg = tal(cmd, struct abort_pkg);
191 abort_pkg->splice_cmd = tal_steal(abort_pkg, splice_cmd);
192 abort_pkg->str = tal_strdup(abort_pkg, str);
193 abort_pkg->code = code;
194
195 req = jsonrpc_request_start(cmd, "abort_channels",
196 abort_get_result, forward_error, abort_pkg);
197
198 added = 0;
199 json_array_start(req->js, "channel_ids");
200 for (size_t i = 0; i < tal_count(splice_cmd->actions); i++) {
201 if (splice_cmd->actions[i]->channel_id) {
202 added++;
203 json_add_channel_id(req->js, NULL,
204 splice_cmd->actions[i]->channel_id);
205 }
206 }
207 json_array_end(req->js);
208
209 if (!added) {
210 plugin_log(cmd->plugin, LOG_DBG,
211 "No channels were stfu'ed, skipping to unreserve"
212 " (psbt:%p)", splice_cmd->psbt);
213 return abort_get_result(cmd, NULL, NULL, NULL, abort_pkg);
214 }
215
216 return send_outreq(req);
217}
218
219static struct command_result *splice_error(struct command *cmd,
220 const char *methodname,

Callers 10

splice_errorFunction · 0.85
notice_missing_fundsFunction · 0.85
calc_in_ppm_and_feeFunction · 0.85
addpsbt_get_resultFunction · 0.85
onchain_wallet_fundFunction · 0.85
check_emergency_satFunction · 0.85
handle_wallet_fundFunction · 0.85
handle_fee_and_ppmFunction · 0.85
continue_spliceFunction · 0.85
execute_spliceFunction · 0.85

Calls 6

json_array_startFunction · 0.85
json_add_channel_idFunction · 0.85
json_array_endFunction · 0.85
abort_get_resultFunction · 0.85
plugin_logFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected