mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
db_col_tx: report txn hex if transaction pulled is invalid
This commit is contained in:
committed by
Rusty Russell
parent
c029de7d56
commit
2918bbbf36
@@ -430,9 +430,20 @@ struct bitcoin_tx *db_col_tx(const tal_t *ctx, struct db_stmt *stmt, const char
|
||||
size_t col = db_query_colnum(stmt, colname);
|
||||
const u8 *src = db_column_blob(stmt, col);
|
||||
size_t len = db_column_bytes(stmt, col);
|
||||
struct bitcoin_tx *tx;
|
||||
bool is_null;
|
||||
|
||||
db_column_null_warn(stmt, colname, col);
|
||||
return pull_bitcoin_tx(ctx, &src, &len);
|
||||
is_null = db_column_null_warn(stmt, colname, col);
|
||||
tx = pull_bitcoin_tx(ctx, &src, &len);
|
||||
|
||||
if (is_null || tx) return tx;
|
||||
|
||||
/* Column wasn't null, but we couldn't retrieve a valid wally_tx! */
|
||||
u8 *tx_dup = tal_dup_arr(stmt, u8, src, len, 0);
|
||||
|
||||
db_fatal("db_col_tx: Invalid bitcoin transaction bytes retrieved: %s",
|
||||
tal_hex(stmt, tx_dup));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wally_psbt *db_col_psbt(const tal_t *ctx, struct db_stmt *stmt, const char *colname)
|
||||
|
||||
Reference in New Issue
Block a user