mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 06:54:30 +01:00
plugins: simplify shutdown loop, simply close the db
The only thing that needs ld->wallet after this is destroy_invoices_waiter (off jsonrpc) Could not find any other destructors (destroy_*) that need wallet or db access after this. Any db access would now segfault.
This commit is contained in:
committed by
Rusty Russell
parent
be196b4219
commit
f936fa926f
@@ -1276,7 +1276,6 @@ struct db *db_setup(const tal_t *ctx, struct lightningd *ld,
|
||||
struct db *db = db_open(ctx, ld->wallet_dsn);
|
||||
bool migrated;
|
||||
db->log = new_log(db, ld->log_book, NULL, "database");
|
||||
db->plugins_shutdown = &ld->plugins->shutdown;
|
||||
|
||||
db_begin_transaction(db);
|
||||
|
||||
@@ -2351,11 +2350,6 @@ void db_changes_add(struct db_stmt *stmt, const char * expanded)
|
||||
tal_arr_expand(&db->changes, tal_strdup(db->changes, expanded));
|
||||
}
|
||||
|
||||
void db_check_plugins_not_shutdown(struct db *db)
|
||||
{
|
||||
assert(!*db->plugins_shutdown);
|
||||
}
|
||||
|
||||
const char **db_changes(struct db *db)
|
||||
{
|
||||
return db->changes;
|
||||
|
||||
@@ -249,9 +249,6 @@ struct db_stmt *db_prepare_v2_(const char *location, struct db *db,
|
||||
#define db_prepare_v2(db,query) \
|
||||
db_prepare_v2_(__FILE__ ":" stringify(__LINE__), db, query)
|
||||
|
||||
/* Check that plugins are not shutting down when calling db_write hook */
|
||||
void db_check_plugins_not_shutdown(struct db *db);
|
||||
|
||||
/**
|
||||
* Access pending changes that have been added to the current transaction.
|
||||
*/
|
||||
|
||||
@@ -34,9 +34,6 @@ struct db {
|
||||
* Used to bump the data_version in the DB.*/
|
||||
bool dirty;
|
||||
|
||||
/* Only needed to check shutdown state of plugins */
|
||||
const bool *plugins_shutdown;
|
||||
|
||||
/* The current DB version we expect to update if changes are
|
||||
* committed. */
|
||||
u32 data_version;
|
||||
|
||||
Reference in New Issue
Block a user