wallet: Add function to retrieve spent UTXOs for a given height

The plan is to eventually use this to tell gossipd about any outputs that were
spent by the last block.
This commit is contained in:
Christian Decker
2020-09-08 12:34:36 +02:00
committed by Rusty Russell
parent 62f80f74ec
commit eeb6e8091b
5 changed files with 88 additions and 26 deletions

View File

@@ -1490,6 +1490,12 @@ struct db_query db_postgres_queries[] = {
.placeholders = 3,
.readonly = true,
},
{
.name = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?",
.query = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = $1",
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT blockheight FROM transactions WHERE id=?",
.query = "SELECT blockheight FROM transactions WHERE id=$1",
@@ -1636,10 +1642,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 271
#define DB_POSTGRES_QUERY_COUNT 272
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:fa885142376ef8ac5cae84c02d379d7e1bf97d3b0c69af46a6054316d2e6a1bc
// SHA256STAMP:9c0282186a89a37a232b8a4f34dceabaf5b53b7cc5c3bc24eb4e53967662cb6f