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

Function txprepare_continue

plugins/txprepare.c:358–404  ·  view source on GitHub ↗

Common point for txprepare and withdraw */

Source from the content-addressed store, hash-verified

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

Callers 3

json_txprepareFunction · 0.85
json_withdrawFunction · 0.85
listfunds_doneFunction · 0.85

Calls 8

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

Tested by

no test coverage detected