Skip to content

Commit

Permalink
db: Make sure to enable foreign keys even after forking
Browse files Browse the repository at this point in the history
This may be causing ElementsProject#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 <[email protected]>
  • Loading branch information
cdecker committed Apr 2, 2018
1 parent e41d565 commit eb531e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions wallet/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eb531e6

Please sign in to comment.