mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
runes: Get next unique id from runes table
This commit is contained in:
parent
9bcabbc912
commit
90824a5d32
2 changed files with 22 additions and 0 deletions
|
@ -5662,6 +5662,21 @@ struct wallet_htlc_iter *wallet_htlcs_next(struct wallet *w,
|
|||
return iter;
|
||||
}
|
||||
|
||||
u64 wallet_get_rune_next_unique_id(const tal_t *ctx, struct wallet *wallet)
|
||||
{
|
||||
struct db_stmt *stmt;
|
||||
u64 next_unique_id;
|
||||
|
||||
stmt = db_prepare_v2(wallet->db, SQL("SELECT (COALESCE(MAX(id), -1) + 1) FROM runes"));
|
||||
db_query_prepared(stmt);
|
||||
db_step(stmt);
|
||||
|
||||
next_unique_id = db_col_u64(stmt, "(COALESCE(MAX(id), -1) + 1)");
|
||||
|
||||
tal_free(stmt);
|
||||
return next_unique_id;
|
||||
}
|
||||
|
||||
struct rune_blacklist *wallet_get_runes_blacklist(const tal_t *ctx, struct wallet *wallet)
|
||||
{
|
||||
struct db_stmt *stmt;
|
||||
|
|
|
@ -1667,6 +1667,13 @@ struct rune_blacklist {
|
|||
u64 start, end;
|
||||
};
|
||||
|
||||
/**
|
||||
* Load the next unique id for rune from the db.
|
||||
* @ctx: tal ctx for return to be tallocated from
|
||||
* @wallet: the wallet
|
||||
*/
|
||||
u64 wallet_get_rune_next_unique_id(const tal_t *ctx, struct wallet *wallet);
|
||||
|
||||
/**
|
||||
* Load the blacklist from the db.
|
||||
* @ctx: tal ctx for return to be tallocated from
|
||||
|
|
Loading…
Add table
Reference in a new issue