Merge bitcoin/bitcoin#32990: wallet: remove outdated pszSkip arg of database Rewrite func

2dfeb6668c wallet: remove outdated `pszSkip` arg of database `Rewrite` func (rkrux)

Pull request description:

  This argument might have been used in the legacy wallets, but I don't see any implementation using this argument in the SQLite wallets. Removing it cleans up the code a bit.

ACKs for top commit:
  achow101:
    ACK 2dfeb6668c
  brunoerg:
    code review ACK 2dfeb6668c

Tree-SHA512: de2178ad6862125f084434ec6a7271d567544870c474c5ea2e75a4f69f3f5eb2170ff46947e098f58e1fa47c35bbe4ebafcd8180581d1f100f1f8d177b32dd91
This commit is contained in:
Ava Chow
2025-07-22 16:41:18 -07:00
6 changed files with 8 additions and 8 deletions

View File

@@ -139,9 +139,9 @@ public:
//! Counts the number of active database users to be sure that the database is not closed while someone is using it
std::atomic<int> m_refcount{0};
/** Rewrite the entire database on disk, with the exception of key pszSkip if non-zero
/** Rewrite the entire database on disk
*/
virtual bool Rewrite(const char* pszSkip=nullptr) = 0;
virtual bool Rewrite() = 0;
/** Back up the entire database to a file.
*/

View File

@@ -35,9 +35,9 @@ public:
/** Open the database if it is not already opened. */
void Open() override;
/** Rewrite the entire database on disk, with the exception of key pszSkip if non-zero
/** Rewrite the entire database on disk
*/
bool Rewrite(const char* pszSkip = nullptr) override { return false; }
bool Rewrite() override { return false; }
/** Back up the entire database to a file.
*/

View File

@@ -336,7 +336,7 @@ void SQLiteDatabase::Open()
}
}
bool SQLiteDatabase::Rewrite(const char* skip)
bool SQLiteDatabase::Rewrite()
{
// Rewrite the database using the VACUUM command: https://sqlite.org/lang_vacuum.html
int ret = sqlite3_exec(m_db, "VACUUM", nullptr, nullptr, nullptr);

View File

@@ -140,7 +140,7 @@ public:
void Close() override;
/** Rewrite the entire database on disk */
bool Rewrite(const char* skip = nullptr) override;
bool Rewrite() override;
/** Back up the entire database to a file.
*/

View File

@@ -104,7 +104,7 @@ public:
void Open() override {}
bool Rewrite(const char* pszSkip=nullptr) override { return m_pass; }
bool Rewrite() override { return m_pass; }
bool Backup(const std::string& strDest) const override { return m_pass; }
void Close() override {}

View File

@@ -2266,7 +2266,7 @@ DBErrors CWallet::LoadWallet()
DBErrors nLoadWalletRet = WalletBatch(GetDatabase()).LoadWallet(this);
if (nLoadWalletRet == DBErrors::NEED_REWRITE)
{
if (GetDatabase().Rewrite("\x04pool"))
if (GetDatabase().Rewrite())
{
for (const auto& spk_man_pair : m_spk_managers) {
spk_man_pair.second->RewriteDB();