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

Function wallet_transactions_by_height

wallet/wallet.c:5267–5294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5265}
5266
5267struct bitcoin_txid *wallet_transactions_by_height(const tal_t *ctx,
5268 struct wallet *w,
5269 const u32 blockheight)
5270{
5271 struct db_stmt *stmt;
5272 struct bitcoin_txid *txids = tal_arr(ctx, struct bitcoin_txid, 0);
5273 int count = 0;
5274
5275 /* Note: blockheight=NULL is not the same as is NULL! */
5276 if (blockheight == 0) {
5277 stmt = db_prepare_v2(
5278 w->db, SQL("SELECT id FROM transactions WHERE blockheight IS NULL"));
5279 } else {
5280 stmt = db_prepare_v2(
5281 w->db, SQL("SELECT id FROM transactions WHERE blockheight=?"));
5282 db_bind_int(stmt, blockheight);
5283 }
5284 db_query_prepared(stmt);
5285
5286 while (db_step(stmt)) {
5287 count++;
5288 tal_resize(&txids, count);
5289 db_col_txid(stmt, "id", &txids[count-1]);
5290 }
5291 tal_free(stmt);
5292
5293 return txids;
5294}
5295
5296void wallet_insert_funding_spend(struct wallet *w,
5297 const struct channel *chan,

Callers 2

remove_tipFunction · 0.85

Calls 5

db_bind_intFunction · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
db_col_txidFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected