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

Function wallet_utxo_get

wallet/wallet.c:372–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372struct utxo *wallet_utxo_get(const tal_t *ctx, struct wallet *w,
373 const struct bitcoin_outpoint *outpoint)
374{
375 struct db_stmt *stmt;
376 struct utxo *utxo;
377
378 stmt = db_prepare_v2(w->db, SQL("SELECT"
379 " prev_out_tx"
380 ", prev_out_index"
381 ", value"
382 ", type"
383 ", status"
384 ", keyindex"
385 ", channel_id"
386 ", peer_id"
387 ", commitment_point"
388 ", option_anchor_outputs"
389 ", confirmation_height"
390 ", spend_height"
391 ", scriptpubkey"
392 ", reserved_til"
393 ", csv_lock"
394 " FROM outputs"
395 " WHERE prev_out_tx = ?"
396 " AND prev_out_index = ?"));
397
398 db_bind_txid(stmt, 0, &outpoint->txid);
399 db_bind_int(stmt, 1, outpoint->n);
400
401 db_query_prepared(stmt);
402
403 if (!db_step(stmt)) {
404 tal_free(stmt);
405 return NULL;
406 }
407
408 utxo = wallet_stmt2output(ctx, stmt);
409 tal_free(stmt);
410
411 return utxo;
412}
413
414static void db_set_utxo(struct db *db, const struct utxo *utxo)
415{

Callers 5

json_reserveinputsFunction · 0.85
json_unreserveinputsFunction · 0.85
param_txoutFunction · 0.85
record_wallet_spendFunction · 0.85

Calls 6

db_bind_txidFunction · 0.85
db_bind_intFunction · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
tal_freeFunction · 0.85
wallet_stmt2outputFunction · 0.85

Tested by

no test coverage detected