aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-06-15 15:31:02 -0400
committerAndrew Chow <achow101-github@achow101.com>2020-07-01 12:32:11 -0400
commitd8e9ca66d119d80acfb2bb3c8940c386ce0fc226 (patch)
treefa63b185eb471fc7725da66db2ab3c4fd2afe7da /src
parent91d109156d63ff81cda534bd7bec8369af0027dd (diff)
walletdb: Move Rewrite into BerkeleyDatabase
Make Rewrite actually a member of BerkeleyDatabase instead of a static function in BerkeleyBatch
Diffstat (limited to 'src')
-rw-r--r--src/wallet/bdb.cpp13
-rw-r--r--src/wallet/bdb.h2
2 files changed, 3 insertions, 12 deletions
diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
index 4856f4bff8..bfd2b9b45e 100644
--- a/src/wallet/bdb.cpp
+++ b/src/wallet/bdb.cpp
@@ -484,13 +484,11 @@ void BerkeleyEnvironment::ReloadDbEnv()
Open(true);
}
-bool BerkeleyBatch::Rewrite(BerkeleyDatabase& database, const char* pszSkip)
+bool BerkeleyDatabase::Rewrite(const char* pszSkip)
{
- if (database.IsDummy()) {
+ if (IsDummy()) {
return true;
}
- BerkeleyEnvironment *env = database.env.get();
- const std::string& strFile = database.strFile;
while (true) {
{
LOCK(cs_db);
@@ -504,7 +502,7 @@ bool BerkeleyBatch::Rewrite(BerkeleyDatabase& database, const char* pszSkip)
LogPrintf("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
std::string strFileRes = strFile + ".rewrite";
{ // surround usage of db with extra {}
- BerkeleyBatch db(database, "r");
+ BerkeleyBatch db(*this, "r");
std::unique_ptr<Db> pdbCopy = MakeUnique<Db>(env->dbenv.get(), 0);
int ret = pdbCopy->open(nullptr, // Txn pointer
@@ -654,11 +652,6 @@ bool BerkeleyDatabase::PeriodicFlush()
return ret;
}
-bool BerkeleyDatabase::Rewrite(const char* pszSkip)
-{
- return BerkeleyBatch::Rewrite(*this, pszSkip);
-}
-
bool BerkeleyDatabase::Backup(const std::string& strDest) const
{
if (IsDummy()) {
diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h
index d15efc810f..73169abde4 100644
--- a/src/wallet/bdb.h
+++ b/src/wallet/bdb.h
@@ -287,8 +287,6 @@ public:
bool TxnBegin();
bool TxnCommit();
bool TxnAbort();
-
- bool static Rewrite(BerkeleyDatabase& database, const char* pszSkip = nullptr);
};
std::string BerkeleyDatabaseVersion();