mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
db: add helper for db_col_psbt
We had db_bind_psbt; this is the missing symmetric response to that
This commit is contained in:
parent
e2a6fd7112
commit
3c98bec693
10
wallet/db.c
10
wallet/db.c
@ -1647,12 +1647,16 @@ struct bitcoin_tx *db_column_tx(const tal_t *ctx, struct db_stmt *stmt, int col)
|
||||
return pull_bitcoin_tx(ctx, &src, &len);
|
||||
}
|
||||
|
||||
struct bitcoin_tx *db_column_psbt_to_tx(const tal_t *ctx, struct db_stmt *stmt, int col)
|
||||
struct wally_psbt *db_column_psbt(const tal_t *ctx, struct db_stmt *stmt, int col)
|
||||
{
|
||||
struct wally_psbt *psbt;
|
||||
const u8 *src = db_column_blob(stmt, col);
|
||||
size_t len = db_column_bytes(stmt, col);
|
||||
psbt = psbt_from_bytes(ctx, src, len);
|
||||
return psbt_from_bytes(ctx, src, len);
|
||||
}
|
||||
|
||||
struct bitcoin_tx *db_column_psbt_to_tx(const tal_t *ctx, struct db_stmt *stmt, int col)
|
||||
{
|
||||
struct wally_psbt *psbt = db_column_psbt(ctx, stmt, col);
|
||||
if (!psbt)
|
||||
return NULL;
|
||||
return bitcoin_tx_with_psbt(ctx, psbt);
|
||||
|
@ -24,6 +24,7 @@ struct onionreply;
|
||||
struct db_stmt;
|
||||
struct db;
|
||||
struct wally_psbt;
|
||||
struct wally_tx;
|
||||
|
||||
/**
|
||||
* Macro to annotate a named SQL query.
|
||||
@ -162,6 +163,7 @@ bool db_column_signature(struct db_stmt *stmt, int col,
|
||||
secp256k1_ecdsa_signature *sig);
|
||||
struct timeabs db_column_timeabs(struct db_stmt *stmt, int col);
|
||||
struct bitcoin_tx *db_column_tx(const tal_t *ctx, struct db_stmt *stmt, int col);
|
||||
struct wally_psbt *db_column_psbt(const tal_t *ctx, struct db_stmt *stmt, int col);
|
||||
struct bitcoin_tx *db_column_psbt_to_tx(const tal_t *ctx, struct db_stmt *stmt, int col);
|
||||
|
||||
struct onionreply *db_column_onionreply(const tal_t *ctx,
|
||||
|
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
@ -1654,4 +1654,4 @@ struct db_query db_postgres_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:b58d5903df88487b84515e511c1cd98e5fb15f86cf9676e3125ab56a27c27877
|
||||
// SHA256STAMP:e395834264c88a46c76e9e19347340507d615ad7902ddb5e179f253db7dc55e7
|
||||
|
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
@ -1654,4 +1654,4 @@ struct db_query db_sqlite3_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:b58d5903df88487b84515e511c1cd98e5fb15f86cf9676e3125ab56a27c27877
|
||||
// SHA256STAMP:e395834264c88a46c76e9e19347340507d615ad7902ddb5e179f253db7dc55e7
|
||||
|
2
wallet/statements_gettextgen.po
generated
2
wallet/statements_gettextgen.po
generated
@ -1089,4 +1089,4 @@ msgstr ""
|
||||
#: wallet/test/run-wallet.c:1359
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:b5142a6c1570a9fdf0745214134e54ff79e3d91408a91a1555cdb0a546fb0c7b
|
||||
# SHA256STAMP:06772e06eea0d31f3172982d9a4fac7326f8ce39868ff405fd4e7babe923f17c
|
||||
|
Loading…
Reference in New Issue
Block a user