| 4178 | } |
| 4179 | |
| 4180 | struct bitcoin_tx *wallet_transaction_get(const tal_t *ctx, struct wallet *w, |
| 4181 | const struct bitcoin_txid *txid) |
| 4182 | { |
| 4183 | struct bitcoin_tx *tx; |
| 4184 | struct db_stmt *stmt = db_prepare_v2( |
| 4185 | w->db, SQL("SELECT rawtx FROM transactions WHERE id=?")); |
| 4186 | db_bind_txid(stmt, 0, txid); |
| 4187 | db_query_prepared(stmt); |
| 4188 | |
| 4189 | if (!db_step(stmt)) { |
| 4190 | tal_free(stmt); |
| 4191 | return NULL; |
| 4192 | } |
| 4193 | |
| 4194 | if (!db_col_is_null(stmt, "rawtx")) |
| 4195 | tx = db_col_tx(ctx, stmt, "rawtx"); |
| 4196 | else |
| 4197 | tx = NULL; |
| 4198 | |
| 4199 | tal_free(stmt); |
| 4200 | return tx; |
| 4201 | } |
| 4202 | |
| 4203 | u32 wallet_transaction_height(struct wallet *w, const struct bitcoin_txid *txid) |
| 4204 | { |
no test coverage detected