diff --git a/src/HashedObject.cpp b/src/HashedObject.cpp index 9fc95a825d..ee992abdb2 100644 --- a/src/HashedObject.cpp +++ b/src/HashedObject.cpp @@ -21,7 +21,6 @@ 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()) { cLog(lsTRACE) << "HOS: no db"; @@ -32,6 +31,7 @@ bool HashedObjectStore::store(HashedObjectType type, uint32 index, cLog(lsTRACE) << "HOS: " << hash << " store: incache"; return false; } + assert(hash == Serializer::getSHA512Half(data)); HashedObject::pointer object = boost::make_shared(type, index, data, hash); if (!mCache.canonicalize(hash, object)) diff --git a/src/SHAMap.cpp b/src/SHAMap.cpp index e3de616d28..def66e4f39 100644 --- a/src/SHAMap.cpp +++ b/src/SHAMap.cpp @@ -716,23 +716,22 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui // Log(lsTRACE) << "fetchNodeExternal: missing " << hash; throw SHAMapMissingNode(mType, id, hash); } - assert(Serializer::getSHA512Half(obj->getData()) == hash); try { SHAMapTreeNode::pointer ret = boost::make_shared(id, obj->getData(), mSeq - 1, snfPREFIX); -#ifdef DEBUG if (id != *ret) { Log(lsFATAL) << "id:" << id << ", got:" << *ret; assert(false); + return SHAMapTreeNode::pointer(); } if (ret->getNodeHash() != hash) { Log(lsFATAL) << "Hashes don't match"; assert(false); + return SHAMapTreeNode::pointer(); } -#endif return ret; } catch (...)