aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/sqlite.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-05-26 20:53:57 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-10-14 11:28:18 -0400
commitb4df8fdb19fcded7e6d491ecf0b705cac0ec76a1 (patch)
treea6eb6a459472caa6328f10887eda5c868df2728f /src/wallet/sqlite.cpp
parent010e3659069e6f97dd7b24483f50ed71042b84b0 (diff)
downloadbitcoin-b4df8fdb19fcded7e6d491ecf0b705cac0ec76a1.tar.xz
Implement SQLiteDatabase::Rewrite
Rewrite uses the VACUUM command which does exactly what we want. A specific advertised use case is to compact a database and ensure that any deleted data is actually deleted.
Diffstat (limited to 'src/wallet/sqlite.cpp')
-rw-r--r--src/wallet/sqlite.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/sqlite.cpp b/src/wallet/sqlite.cpp
index 1889313dd5..f9c4dfb2a5 100644
--- a/src/wallet/sqlite.cpp
+++ b/src/wallet/sqlite.cpp
@@ -181,7 +181,9 @@ void SQLiteDatabase::Open()
bool SQLiteDatabase::Rewrite(const char* skip)
{
- return false;
+ // Rewrite the database using the VACUUM command: https://sqlite.org/lang_vacuum.html
+ int ret = sqlite3_exec(m_db, "VACUUM", nullptr, nullptr, nullptr);
+ return ret == SQLITE_OK;
}
bool SQLiteDatabase::Backup(const std::string& dest) const