Skip to content

Commit

Permalink
Merge 01129ca into merged_master (Bitcoin PR bitcoin/bitcoin#23214)
Browse files Browse the repository at this point in the history
  • Loading branch information
delta1 committed May 10, 2023
2 parents 73a7ae0 + 01129ca commit e240720
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,15 @@ bool CDBWrapper::WriteBatch(CDBBatch& batch, bool fSync)
return true;
}

size_t CDBWrapper::DynamicMemoryUsage() const {
size_t CDBWrapper::DynamicMemoryUsage() const
{
std::string memory;
if (!pdb->GetProperty("leveldb.approximate-memory-usage", &memory)) {
std::optional<size_t> parsed;
if (!pdb->GetProperty("leveldb.approximate-memory-usage", &memory) || !(parsed = ToIntegral<size_t>(memory))) {
LogPrint(BCLog::LEVELDB, "Failed to get approximate-memory-usage property\n");
return 0;
}
return stoul(memory);
return parsed.value();
}

// Prefixed with null character to avoid collisions with other keys
Expand Down
2 changes: 0 additions & 2 deletions test/lint/lint-locale-dependence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export LC_ALL=C
KNOWN_VIOLATIONS=(
"src/bitcoin-tx.cpp.*stoul"
"src/chain.h.*trim"
"src/dbwrapper.cpp.*stoul"
"src/dbwrapper.cpp:.*vsnprintf"
"src/init.cpp.*trim"
"src/rest.cpp:.*strtol"
"src/test/dbwrapper_tests.cpp:.*snprintf"
Expand Down

0 comments on commit e240720

Please sign in to comment.