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

Function db_setup

wallet/db.c:1006–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1004}
1005
1006struct db *db_setup(const tal_t *ctx, struct lightningd *ld,
1007 const struct ext_key *bip32_base)
1008{
1009 struct db *db = db_open(ctx, ld->wallet_dsn);
1010 bool migrated;
1011
1012 db->report_changes_fn = plugin_hook_db_sync;
1013
1014 db_begin_transaction(db);
1015 db->data_version = db_data_version_get(db);
1016
1017 migrated = db_migrate(ld, db, bip32_base);
1018
1019 db_commit_transaction(db);
1020
1021 /* This needs to be done outside a transaction, apparently.
1022 * It's a good idea to do this every so often, and on db
1023 * upgrade is a reasonable time. */
1024 if (migrated && !db->config->vacuum_fn(db))
1025 db_fatal("Error vacuuming db: %s", db->error);
1026
1027 return db;
1028}
1029
1030/* Will apply the current config fee settings to all channels */
1031static void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db,

Callers 1

wallet_newFunction · 0.70

Calls 5

db_openFunction · 0.85
db_data_version_getFunction · 0.85
db_migrateFunction · 0.70
db_fatalFunction · 0.70
db_commit_transactionFunction · 0.50

Tested by

no test coverage detected