refactor: inline constant return value of `CDBWrapper::Erase` and `BlockTreeDB::WriteReindexing`
What changed, and why it matters
This is a small code cleanup (refactor) that removes always-true return values from two database helper functions. The return values were never checked by callers, so the change has no effect on behavior and no security relevance.
No action needed; this is a benign refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
CDBWrapper::Erase previously returned bool true unconditionally; it is changed to return void. BlockTreeDB::WriteReindexing previously returned bool (true on write path, or the constant true from Erase on erase path); it is also changed to return void. The only caller of WriteReindexing ignored the return value. No logic, error handling, or data flow changes.
Changed components
src/dbwrapper.hsrc/node/blockstorage.cppsrc/node/blockstorage.hInspect captured patch +4 / −6
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 50be26fb..c770df8e 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -255,12 +255,11 @@ public:
}
template <typename K>
- bool Erase(const K& key, bool fSync = false)
+ void Erase(const K& key, bool fSync = false)
{
CDBBatch batch(*this);
batch.Erase(key);
WriteBatch(batch, fSync);
- return true;
}
void WriteBatch(CDBBatch& batch, bool fSync = false);
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index 7371111c..5a54baf2 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -59,13 +59,12 @@ bool BlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo& info)
return Read(std::make_pair(DB_BLOCK_FILES, nFile), info);
}
-bool BlockTreeDB::WriteReindexing(bool fReindexing)
+void BlockTreeDB::WriteReindexing(bool fReindexing)
{
if (fReindexing) {
Write(DB_REINDEX_FLAG, uint8_t{'1'});
- return true;
} else {
- return Erase(DB_REINDEX_FLAG);
+ Erase(DB_REINDEX_FLAG);
}
}
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
index cee0eb61..7d6f78f2 100644
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -55,7 +55,7 @@ public:
bool WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*>>& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo);
bool ReadBlockFileInfo(int nFile, CBlockFileInfo& info);
bool ReadLastBlockFile(int& nFile);
- bool WriteReindexing(bool fReindexing);
+ void WriteReindexing(bool fReindexing);
void ReadReindexing(bool& fReindexing);
bool WriteFlag(const std::string& name, bool fValue);
bool ReadFlag(const std::string& name, bool& fValue);
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.