If a tree consists only of a matching leaf, don't include that leaf in the fetch pack.

This commit is contained in:
JoelKatz
2013-07-02 13:31:43 -07:00
parent 6203024bc6
commit 0183e4d177

View File

@@ -440,6 +440,10 @@ bool SHAMap::deepCompare (SHAMap& other)
bool SHAMap::hasInnerNode (const SHAMapNode& nodeID, uint256 const& nodeHash)
{
boost::unordered_map<SHAMapNode, SHAMapTreeNode::pointer>::iterator it = mTNByID.find (nodeID);
if (it != mTNByID.end())
return it->second->getNodeHash() == nodeHash;
SHAMapTreeNode* node = root.get ();
while (node->isInner () && (node->getDepth () < nodeID.getDepth ()))
@@ -474,7 +478,7 @@ bool SHAMap::hasLeafNode (uint256 const& tag, uint256 const& nodeHash)
node = getNodePointer (node->getChildNodeID (branch), nextHash);
}
return false;
return node->getNodeHash() == nodeHash;
}
static void addFPtoList (std::list<SHAMap::fetchPackEntry_t>& list, const uint256& hash, const Blob& blob)