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

Function db_setup

wallet/db.c:103–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103struct db *db_setup(const tal_t *ctx, struct lightningd *ld,
104 const struct ext_key *bip32_base)
105{
106 struct db *db = db_open(ctx, ld->wallet_dsn, ld->developer, true,
107 db_error, ld);
108 bool migrated;
109
110 db->report_changes_fn = plugin_hook_db_sync;
111
112 db_begin_transaction(db);
113 db->data_version = db_data_version_get(db);
114
115 migrated = db_migrate(ld, db, bip32_base);
116
117 db_commit_transaction(db);
118
119 db->in_migration = false;
120
121 /* This needs to be done outside a transaction, apparently.
122 * It's a good idea to do this every so often, and on db
123 * upgrade is a reasonable time. */
124 if (migrated && !db->config->vacuum_fn(db))
125 db_fatal(db, "Error vacuuming db: %s", db->error);
126
127 return db;
128}
129
130/* Will apply the current config fee settings to all channels */
131void migrate_pr2342_feerate_per_channel(struct lightningd *ld, struct db *db)

Callers 2

wallet_newFunction · 0.70
mainFunction · 0.50

Calls 4

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

Tested by 1

mainFunction · 0.40