diff options
-rw-r--r-- | src/dbwrapper.cpp | 5 | ||||
-rw-r--r-- | src/dbwrapper.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 87d46f3192..dbf1d18de2 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -312,6 +312,11 @@ void CDBIterator::SeekImpl(Span<const std::byte> ssKey) piter->Seek(slKey); } +Span<const std::byte> CDBIterator::GetKeyImpl() const +{ + return MakeByteSpan(piter->key()); +} + CDBIterator::~CDBIterator() { delete piter; } bool CDBIterator::Valid() const { return piter->Valid(); } void CDBIterator::SeekToFirst() { piter->SeekToFirst(); } diff --git a/src/dbwrapper.h b/src/dbwrapper.h index aa2b31b160..9aadeef76d 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -141,6 +141,7 @@ private: leveldb::Iterator *piter; void SeekImpl(Span<const std::byte> ssKey); + Span<const std::byte> GetKeyImpl() const; public: @@ -166,9 +167,8 @@ public: void Next(); template<typename K> bool GetKey(K& key) { - leveldb::Slice slKey = piter->key(); try { - DataStream ssKey{MakeByteSpan(slKey)}; + DataStream ssKey{GetKeyImpl()}; ssKey >> key; } catch (const std::exception&) { return false; |