mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
refactor: inline constant return value of CDBWrapper::WriteBatch
`WriteBatch` can only ever return `true` - its errors are handled by throwing a `throw dbwrapper_error` instead. The boolean return value is quite confusing, especially since it's symmetric with `CDBWrapper::Read`, which catches the exceptions and returns a boolean instead. We're removing the constant return value and inlining `true` for its usages.
This commit is contained in:
@@ -234,7 +234,8 @@ public:
|
||||
{
|
||||
CDBBatch batch(*this);
|
||||
batch.Write(key, value);
|
||||
return WriteBatch(batch, fSync);
|
||||
WriteBatch(batch, fSync);
|
||||
return true;
|
||||
}
|
||||
|
||||
//! @returns filesystem path to the on-disk data.
|
||||
@@ -259,10 +260,11 @@ public:
|
||||
{
|
||||
CDBBatch batch(*this);
|
||||
batch.Erase(key);
|
||||
return WriteBatch(batch, fSync);
|
||||
WriteBatch(batch, fSync);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WriteBatch(CDBBatch& batch, bool fSync = false);
|
||||
void WriteBatch(CDBBatch& batch, bool fSync = false);
|
||||
|
||||
// Get an estimate of LevelDB memory usage (in bytes).
|
||||
size_t DynamicMemoryUsage() const;
|
||||
|
||||
Reference in New Issue
Block a user