Skip to content

Commit f023b7c

Browse files
committed
wallet: Enforce sqlite serialized threading mode
1 parent 6173269 commit f023b7c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wallet/sqlite.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_pa
4848
if (ret != SQLITE_OK) {
4949
throw std::runtime_error(strprintf("SQLiteDatabase: Failed to setup error log: %s\n", sqlite3_errstr(ret)));
5050
}
51+
// Force serialized threading mode
52+
ret = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
53+
if (ret != SQLITE_OK) {
54+
throw std::runtime_error(strprintf("SQLiteDatabase: Failed to configure serialized threading mode: %s\n", sqlite3_errstr(ret)));
55+
}
5156
}
5257
int ret = sqlite3_initialize(); // This is a no-op if sqlite3 is already initialized
5358
if (ret != SQLITE_OK) {

0 commit comments

Comments
 (0)