| 5265 | } |
| 5266 | |
| 5267 | struct 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 | |
| 5296 | void wallet_insert_funding_spend(struct wallet *w, |
| 5297 | const struct channel *chan, |
no test coverage detected