MCPcopy Create free account
hub / github.com/ElementsProject/lightning / db_col_tx

Function db_col_tx

db/bindings.c:470–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470struct 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
492struct wally_psbt *db_col_psbt(const tal_t *ctx, struct db_stmt *stmt, const char *colname)
493{

Callers 5

migrate_last_tx_to_psbtFunction · 0.85
wallet_transaction_getFunction · 0.85
wallet_get_funding_spendFunction · 0.85
wallet_transactions_getFunction · 0.85

Calls 7

db_query_colnumFunction · 0.85
db_column_blobFunction · 0.85
db_column_bytesFunction · 0.85
db_column_null_warnFunction · 0.85
pull_bitcoin_txFunction · 0.85
db_fatalFunction · 0.85
tal_hexFunction · 0.85

Tested by

no test coverage detected