diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index dbf1d18de2b..2f0b9a5ff34 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -317,6 +317,11 @@ Span CDBIterator::GetKeyImpl() const return MakeByteSpan(piter->key()); } +Span CDBIterator::GetValueImpl() const +{ + return MakeByteSpan(piter->value()); +} + 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 9aadeef76db..2e6cc4d81e0 100644 --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include namespace leveldb { class Env; +class Iterator; } static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64; @@ -142,6 +142,7 @@ private: void SeekImpl(Span ssKey); Span GetKeyImpl() const; + Span GetValueImpl() const; public: @@ -177,9 +178,8 @@ public: } template bool GetValue(V& value) { - leveldb::Slice slValue = piter->value(); try { - CDataStream ssValue{MakeByteSpan(slValue), SER_DISK, CLIENT_VERSION}; + CDataStream ssValue{GetValueImpl(), SER_DISK, CLIENT_VERSION}; ssValue.Xor(dbwrapper_private::GetObfuscateKey(parent)); ssValue >> value; } catch (const std::exception&) {