wallet: remove unimplemented `RewriteDB` calls from SPKM
What changed, and why it matters
This commit removes leftover calls to a wallet method called RewriteDB that no longer had any real implementation. It is a small code cleanup with no security impact.
No security action needed; this is a benign cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes the virtual ScriptPubKeyMan::RewriteDB() method (which was an empty default) and removes the loop that called it on each SPKM after a successful database rewrite in CWallet::PopulateWalletFromDB(). Since no subclass overrode RewriteDB(), the calls were no-ops. The actual database rewrite via GetDatabase().Rewrite() is preserved.
Changed components
src/wallet/scriptpubkeyman.hsrc/wallet/wallet.cppInspect captured patch +2 / −11
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index 00dd6eed..cf024294 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -120,9 +120,6 @@ public:
virtual bool HavePrivateKeys() const { return false; }
virtual bool HaveCryptedKeys() const { return false; }
- //! The action to do when the DB needs rewrite
- virtual void RewriteDB() {}
-
virtual unsigned int GetKeyPoolSize() const { return 0; }
virtual int64_t GetTimeFirstKey() const { return 0; }
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index b1562952..e1e0d307 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2357,14 +2357,8 @@ DBErrors CWallet::PopulateWalletFromDB(bilingual_str& error, std::vector<bilingu
Assert(m_spk_managers.empty());
Assert(m_wallet_flags == 0);
DBErrors nLoadWalletRet = WalletBatch(GetDatabase()).LoadWallet(this);
- if (nLoadWalletRet == DBErrors::NEED_REWRITE)
- {
- if (GetDatabase().Rewrite())
- {
- for (const auto& spk_man_pair : m_spk_managers) {
- spk_man_pair.second->RewriteDB();
- }
- }
+ if (nLoadWalletRet == DBErrors::NEED_REWRITE) {
+ GetDatabase().Rewrite();
}
if (m_spk_managers.empty()) {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.