X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fdb.cpp;h=68d19fe540f3e32edba7c79c3c2eee62cac7787b;hp=6dde84e90fec14f166235d456c382f71e364aeec;hb=6aba6f08af53e3fa49ab4d1ef002e6771d0ce358;hpb=5161066e3cb631292014ee650ab08c012ff4a5c5 diff --git a/src/db.cpp b/src/db.cpp index 6dde84e..68d19fe 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -118,13 +118,13 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_) nBlocks = nMaxLocks / 48768; nDeepReorg = (nBlocks - 1) / 2; - printf("Final lk_max_locks is %lu, sufficient for (worst case) %d block%s in a single transaction (up to a %d-deep reorganization)\n", (unsigned long)nMaxLocks, nBlocks, (nBlocks == 1) ? "" : "s", nDeepReorg); + printf("Final lk_max_locks is %u, sufficient for (worst case) %d block%s in a single transaction (up to a %d-deep reorganization)\n", nMaxLocks, nBlocks, (nBlocks == 1) ? "" : "s", nDeepReorg); if (nDeepReorg < 3) { if (nBlocks < 1) - strMessage = strprintf(_("Warning: DB_CONFIG has set_lk_max_locks %lu, which may be too low for a single block. If this limit is reached, NovaCoin may stop working."), (unsigned long)nMaxLocks); + strMessage = strprintf(_("Warning: DB_CONFIG has set_lk_max_locks %u, which may be too low for a single block. If this limit is reached, NovaCoin may stop working."), nMaxLocks); else - strMessage = strprintf(_("Warning: DB_CONFIG has set_lk_max_locks %lu, which may be too low for a common blockchain reorganization. If this limit is reached, NovaCoin may stop working."), (unsigned long)nMaxLocks); + strMessage = strprintf(_("Warning: DB_CONFIG has set_lk_max_locks %u, which may be too low for a common blockchain reorganization. If this limit is reached, NovaCoin may stop working."), nMaxLocks); strMiscWarning = strMessage; printf("*** %s\n", strMessage.c_str()); @@ -396,7 +396,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) } Dbc* pcursor = db.GetCursor(); - if (pcursor) + if (pcursor) { while (fSuccess) { CDataStream ssKey(SER_DISK, CLIENT_VERSION); @@ -413,9 +413,14 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) fSuccess = false; break; } - if (pszSkip && - strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), strlen(pszSkip))) == 0) - continue; + + if (pszSkip != NULL) + { + size_t pszSkipLen = strlen(pszSkip); + if (strncmp(&ssKey[0], pszSkip, std::min(ssKey.size(), pszSkipLen)) == 0) + continue; + } + if (strncmp(&ssKey[0], "\x07version", 8) == 0) { // Update version: @@ -428,6 +433,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) if (ret2 > 0) fSuccess = false; } + } if (fSuccess) { db.Close();