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

Function mfc_cleanup_psbt

plugins/spender/multifundchannel.c:166–195  ·  view source on GitHub ↗

Cleans up a txid by doing `txdiscard` on it. */

Source from the content-addressed store, hash-verified

164
165/* Cleans up a txid by doing `txdiscard` on it. */
166static void
167mfc_cleanup_psbt(struct command *cmd,
168 struct multifundchannel_cleanup *cleanup,
169 struct wally_psbt *psbt)
170{
171 struct wally_psbt *pruned_psbt;
172 struct out_req *req = jsonrpc_request_start(cmd->plugin,
173 cmd,
174 "unreserveinputs",
175 &mfc_cleanup_done,
176 &mfc_cleanup_done,
177 cleanup);
178
179 /* We might have peer's inputs on this, get rid of them */
180 tal_wally_start();
181 if (wally_psbt_clone_alloc(psbt, 0, &pruned_psbt) != WALLY_OK)
182 abort();
183 tal_wally_end_onto(NULL, pruned_psbt, struct wally_psbt);
184
185 for (size_t i = pruned_psbt->num_inputs - 1;
186 i < pruned_psbt->num_inputs;
187 i--) {
188 if (!psbt_input_is_ours(&pruned_psbt->inputs[i]))
189 psbt_rm_input(pruned_psbt, i);
190 }
191
192 json_add_psbt(req->js, "psbt", take(pruned_psbt));
193 json_add_u32(req->js, "reserve", 2016);
194 send_outreq(cmd->plugin, req);
195}
196
197/* Cleans up a `openchannel_init` by doing `openchannel_abort` for the channel*/
198static void

Callers 1

mfc_cleanup_Function · 0.85

Calls 7

tal_wally_startFunction · 0.85
abortFunction · 0.85
psbt_input_is_oursFunction · 0.85
psbt_rm_inputFunction · 0.85
json_add_psbtFunction · 0.85
json_add_u32Function · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected