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

Function reserve_and_report

wallet/reservation.c:51–78  ·  view source on GitHub ↗

Reserve these UTXOs and print to JSON */

Source from the content-addressed store, hash-verified

49
50/* Reserve these UTXOs and print to JSON */
51static void reserve_and_report(struct json_stream *response,
52 struct wallet *wallet,
53 u32 current_height,
54 u32 reserve,
55 struct utxo **utxos)
56{
57 json_array_start(response, "reservations");
58 for (size_t i = 0; i < tal_count(utxos); i++) {
59 enum output_status oldstatus;
60 u32 old_res;
61
62 oldstatus = utxos[i]->status;
63 old_res = utxos[i]->reserved_til;
64
65 if (!wallet_reserve_utxo(wallet,
66 utxos[i],
67 current_height,
68 reserve)) {
69 fatal("Unable to reserve %s!",
70 type_to_string(tmpctx,
71 struct bitcoin_outpoint,
72 &utxos[i]->outpoint));
73 }
74 json_add_reservestatus(response, utxos[i], oldstatus, old_res,
75 current_height);
76 }
77 json_array_end(response);
78}
79
80static struct command_result *json_reserveinputs(struct command *cmd,
81 const char *buffer,

Callers 2

json_reserveinputsFunction · 0.85
finish_psbtFunction · 0.85

Calls 6

wallet_reserve_utxoFunction · 0.85
json_add_reservestatusFunction · 0.85
json_array_startFunction · 0.50
fatalFunction · 0.50
type_to_stringClass · 0.50
json_array_endFunction · 0.50

Tested by

no test coverage detected