index: Remove return value from Commit()
What changed, and why it matters
This is a small internal cleanup change in Bitcoin Core. A helper function called Commit() previously returned true or false to indicate success or failure, but nothing in the code was actually checking that result. The change removes the unused return value so the function now returns nothing. There is no security-relevant behavior change: the same error is still logged when commit fails, and callers still proceed the same way as before.
No security action needed. Treat as normal code cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
BaseIndex::Commit() in src/index/base.cpp and src/index/base.h is changed from returning bool to returning void. The function body still checks whether the underlying commit succeeded and logs an error if not, but the true/false return statements are removed. No callers are updated because none consumed the return value. This is a pure refactor with no functional change to control flow or error handling.
Changed components
src/index/base.cppsrc/index/base.hInspect captured patch +2 / −4
diff --git a/src/index/base.cpp b/src/index/base.cpp
index 906ed265..bcd7c434 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -273,7 +273,7 @@ void BaseIndex::Sync()
}
}
-bool BaseIndex::Commit()
+void BaseIndex::Commit()
{
// Don't commit anything if we haven't indexed any block yet
// (this could happen if init is interrupted).
@@ -288,9 +288,7 @@ bool BaseIndex::Commit()
}
if (!ok) {
LogError("Failed to commit latest %s state", GetName());
- return false;
}
- return true;
}
bool BaseIndex::Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_tip)
diff --git a/src/index/base.h b/src/index/base.h
index 6d7e86ec..00ce800d 100644
--- a/src/index/base.h
+++ b/src/index/base.h
@@ -101,7 +101,7 @@ private:
/// from further behind on reboot. If the new state is not a successor of the previous state (due
/// to a chain reorganization), the index must halt until Commit succeeds or else it could end up
/// getting corrupted.
- bool Commit();
+ void Commit();
/// Loop over disconnected blocks and call CustomRemove.
bool Rewind(const CBlockIndex* current_tip, const CBlockIndex* new_tip);
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.