| 468 | } |
| 469 | |
| 470 | struct bitcoin_tx *db_col_tx(const tal_t *ctx, struct db_stmt *stmt, const char *colname) |
| 471 | { |
| 472 | size_t col = db_query_colnum(stmt, colname); |
| 473 | const u8 *src = db_column_blob(stmt, col); |
| 474 | size_t len = db_column_bytes(stmt, col); |
| 475 | struct bitcoin_tx *tx; |
| 476 | bool is_null; |
| 477 | |
| 478 | is_null = db_column_null_warn(stmt, colname, col); |
| 479 | tx = pull_bitcoin_tx(ctx, &src, &len); |
| 480 | |
| 481 | if (is_null || tx) return tx; |
| 482 | |
| 483 | /* Column wasn't null, but we couldn't retrieve a valid wally_tx! */ |
| 484 | u8 *tx_dup = tal_dup_arr(stmt, u8, src, len, 0); |
| 485 | |
| 486 | db_fatal(stmt->db, |
| 487 | "db_col_tx: Invalid bitcoin transaction bytes retrieved: %s", |
| 488 | tal_hex(stmt, tx_dup)); |
| 489 | return NULL; |
| 490 | } |
| 491 | |
| 492 | struct wally_psbt *db_col_psbt(const tal_t *ctx, struct db_stmt *stmt, const char *colname) |
| 493 | { |
no test coverage detected