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

Function db_set_utxo

wallet/wallet.c:414–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414static void db_set_utxo(struct db *db, const struct utxo *utxo)
415{
416 struct db_stmt *stmt;
417
418 if (utxo->status == OUTPUT_STATE_RESERVED)
419 assert(utxo->reserved_til);
420 else
421 assert(!utxo->reserved_til);
422
423 stmt = db_prepare_v2(
424 db, SQL("UPDATE outputs SET status=?, reserved_til=? "
425 "WHERE prev_out_tx=? AND prev_out_index=?"));
426 db_bind_int(stmt, 0, output_status_in_db(utxo->status));
427 db_bind_int(stmt, 1, utxo->reserved_til);
428 db_bind_txid(stmt, 2, &utxo->outpoint.txid);
429 db_bind_int(stmt, 3, utxo->outpoint.n);
430 db_exec_prepared_v2(take(stmt));
431}
432
433bool wallet_reserve_utxo(struct wallet *w, struct utxo *utxo,
434 u32 current_height,

Callers 2

wallet_reserve_utxoFunction · 0.85
wallet_unreserve_utxoFunction · 0.85

Calls 4

db_bind_intFunction · 0.85
output_status_in_dbFunction · 0.85
db_bind_txidFunction · 0.85
db_exec_prepared_v2Function · 0.85

Tested by

no test coverage detected