Fix race condition and ub (#631)

This commit is contained in:
Alex Kremer
2023-05-10 18:35:04 +01:00
committed by GitHub
parent b3db4cadab
commit 4cae248b5c
17 changed files with 416 additions and 324 deletions

View File

@@ -96,9 +96,9 @@ SimpleCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
std::optional<Blob>
SimpleCache::get(ripple::uint256 const& key, uint32_t seq) const
{
std::shared_lock lck{mtx_};
if (seq > latestSeq_)
return {};
std::shared_lock lck{mtx_};
objectReqCounter_++;
auto e = map_.find(key);
if (e == map_.end())