diff --git a/src/HashedObject.cpp b/src/HashedObject.cpp index 4305a5b5c..8c9ef0ac7 100644 --- a/src/HashedObject.cpp +++ b/src/HashedObject.cpp @@ -17,6 +17,7 @@ HashedObjectStore::HashedObjectStore(int cacheSize, int cacheAge) : bool HashedObjectStore::store(HashedObjectType type, uint32 index, const std::vector& data, const uint256& hash) { // return: false=already in cache, true = added to cache + assert(hash == Serializer::getSHA512Half(data)); if (!theApp->getHashNodeDB()) return true; if (mCache.touch(hash)) { @@ -25,7 +26,7 @@ bool HashedObjectStore::store(HashedObjectType type, uint32 index, } HashedObject::pointer object = boost::make_shared(type, index, data, hash); - + if (!mCache.canonicalize(hash, object)) { boost::recursive_mutex::scoped_lock sl(mWriteMutex); mWriteSet.push_back(object); @@ -126,6 +127,8 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash) db->getBinary("Object", &(data.front()), size); db->endIterRows(); + assert(Serializer::getSHA512Half(data) == hash); + HashedObjectType htype = UNKNOWN; switch(type[0]) {