Last part of the fetch pack code.

This commit is contained in:
JoelKatz
2013-04-22 06:56:11 -07:00
parent b3bd10c078
commit 8a368204c1
16 changed files with 160 additions and 38 deletions

View File

@@ -2058,7 +2058,21 @@ void NetworkOPs::addFetchPack(const uint256& hash, boost::shared_ptr< std::vecto
bool NetworkOPs::getFetchPack(const uint256& hash, std::vector<unsigned char>& data)
{
return mFetchPack.retrieve(hash, data);
bool ret = mFetchPack.retrieve(hash, data);
if (!ret)
return false;
if (hash != Serializer::getSHA512Half(data))
{
cLog(lsWARNING) << "Bad entry in fetch pack";
return false;
}
cLog(lsTRACE) << hash << " found in fetch pack";
return true;
}
int NetworkOPs::getFetchSize()
{
return mFetchPack.getCacheSize();
}
// vim:ts=4