| 5221 | } |
| 5222 | |
| 5223 | struct bitcoin_tx *wallet_transaction_get(const tal_t *ctx, struct wallet *w, |
| 5224 | const struct bitcoin_txid *txid) |
| 5225 | { |
| 5226 | struct bitcoin_tx *tx; |
| 5227 | struct db_stmt *stmt = db_prepare_v2( |
| 5228 | w->db, SQL("SELECT rawtx FROM transactions WHERE id=?")); |
| 5229 | db_bind_txid(stmt, txid); |
| 5230 | db_query_prepared(stmt); |
| 5231 | |
| 5232 | if (!db_step(stmt)) { |
| 5233 | tal_free(stmt); |
| 5234 | return NULL; |
| 5235 | } |
| 5236 | |
| 5237 | if (!db_col_is_null(stmt, "rawtx")) |
| 5238 | tx = db_col_tx(ctx, stmt, "rawtx"); |
| 5239 | else |
| 5240 | tx = NULL; |
| 5241 | |
| 5242 | tal_free(stmt); |
| 5243 | return tx; |
| 5244 | } |
| 5245 | |
| 5246 | u32 wallet_transaction_height(struct wallet *w, const struct bitcoin_txid *txid) |
| 5247 | { |
no test coverage detected