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

Function txprepare_continue

plugins/txprepare.c:349–391  ·  view source on GitHub ↗

Common point for txprepare and withdraw */

Source from the content-addressed store, hash-verified

347
348/* Common point for txprepare and withdraw */
349static struct command_result *txprepare_continue(struct command *cmd,
350 struct txprepare *txp,
351 const char *feerate,
352 unsigned int *minconf,
353 struct bitcoin_outpoint *utxos,
354 bool is_withdraw)
355{
356 struct out_req *req;
357
358 txp->is_withdraw = is_withdraw;
359
360 /* p_opt_def doesn't compile with strings... */
361 if (!feerate)
362 feerate = "opening";
363
364 /* These calls are deliberately very similar, but utxopsbt wants utxos,
365 * and fundpsbt wants minconf */
366 if (utxos) {
367 req = jsonrpc_request_start(cmd->plugin, cmd, "utxopsbt",
368 psbt_created, forward_error,
369 txp);
370 json_array_start(req->js, "utxos");
371 for (size_t i = 0; i < tal_count(utxos); i++) {
372 json_add_outpoint(req->js, NULL, &utxos[i]);
373 }
374 json_array_end(req->js);
375 } else {
376 req = jsonrpc_request_start(cmd->plugin, cmd, "fundpsbt",
377 psbt_created, forward_error,
378 txp);
379 json_add_u32(req->js, "minconf", *minconf);
380 }
381
382 if (txp->all_output_idx == -1)
383 json_add_sats(req->js, "satoshi", txp->output_total);
384 else
385 json_add_string(req->js, "satoshi", "all");
386
387 json_add_u32(req->js, "startweight", txp->weight);
388
389 json_add_string(req->js, "feerate", feerate);
390 return send_outreq(cmd->plugin, req);
391}
392
393static struct command_result *json_txprepare(struct command *cmd,
394 const char *buffer,

Callers 2

json_txprepareFunction · 0.85
json_withdrawFunction · 0.85

Calls 7

json_add_outpointFunction · 0.85
json_add_satsFunction · 0.85
send_outreqFunction · 0.70
json_array_startFunction · 0.50
json_array_endFunction · 0.50
json_add_u32Function · 0.50
json_add_stringFunction · 0.50

Tested by

no test coverage detected