From eb531e6da7e6e0b7d0e2ad4cf070f1a96fc91c33 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 2 Apr 2018 15:42:44 +0200 Subject: [PATCH] db: Make sure to enable foreign keys even after forking This may be causing #1280, since with `--daemon` the DB is being reopened without enabling the foreign key relations and hence the delete cascades. Signed-off-by: Christian Decker --- wallet/db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wallet/db.c b/wallet/db.c index 9c22b9af5..bbe3fd7a5 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -522,6 +522,7 @@ void db_reopen_after_fork(struct db *db) fatal("failed to re-open database %s: %s", db->filename, sqlite3_errstr(err)); } + db_do_exec(__func__, db, "PRAGMA foreign_keys = ON;"); } s64 db_get_intvar(struct db *db, char *varname, s64 defval)