2018-03-22 11:36:25 +01:00
|
|
|
#ifndef LIGHTNING_WALLET_DB_H
|
|
|
|
#define LIGHTNING_WALLET_DB_H
|
2017-05-12 20:24:18 +02:00
|
|
|
#include "config.h"
|
2018-03-07 01:06:07 +01:00
|
|
|
|
2020-07-29 03:20:30 +02:00
|
|
|
struct ext_key;
|
2023-07-22 09:45:49 +02:00
|
|
|
struct indexes;
|
2019-02-24 06:12:09 +01:00
|
|
|
struct lightningd;
|
2019-07-25 22:45:02 +02:00
|
|
|
struct db_stmt;
|
2019-07-23 20:45:06 +02:00
|
|
|
struct db;
|
2019-07-17 18:11:19 +02:00
|
|
|
|
2017-05-12 20:24:18 +02:00
|
|
|
/**
|
|
|
|
* db_setup - Open a the lightningd database and update the schema
|
|
|
|
*
|
|
|
|
* Opens the database, creating it if necessary, and applying
|
|
|
|
* migrations until the schema is updated to the current state.
|
2017-11-01 02:21:56 +01:00
|
|
|
* Calls fatal() on error.
|
2017-05-12 20:24:18 +02:00
|
|
|
*
|
|
|
|
* Params:
|
|
|
|
* @ctx: the tal_t context to allocate from
|
2019-03-01 23:18:40 +01:00
|
|
|
* @ld: the lightningd context to hand to upgrade functions.
|
2020-07-29 03:20:30 +02:00
|
|
|
* @bip32_base: the base all of our pubkeys are constructed on
|
2017-05-12 20:24:18 +02:00
|
|
|
*/
|
2020-07-29 03:20:30 +02:00
|
|
|
struct db *db_setup(const tal_t *ctx, struct lightningd *ld,
|
|
|
|
const struct ext_key *bip32_base);
|
2017-05-12 20:24:18 +02:00
|
|
|
|
2023-07-22 09:45:49 +02:00
|
|
|
/* We store last wait indices in our var table. */
|
|
|
|
void load_indexes(struct db *db, struct indexes *indexes);
|
|
|
|
|
2023-07-25 05:14:35 +02:00
|
|
|
/* Migration function for old commando datastore runes. */
|
|
|
|
void migrate_datastore_commando_runes(struct lightningd *ld, struct db *db);
|
2023-08-30 06:55:13 +02:00
|
|
|
/* Migrate old runes with incorrect id fields */
|
|
|
|
void migrate_runes_idfix(struct lightningd *ld, struct db *db);
|
2018-03-22 11:36:25 +01:00
|
|
|
#endif /* LIGHTNING_WALLET_DB_H */
|