Map sync bugfix - wrong hash caused 'fullBelow' optimization to fail.

This commit is contained in:
JoelKatz
2013-04-21 12:49:27 -07:00
parent bad215d607
commit b573b1915b
3 changed files with 6 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ DECLARE_INSTANCE(SHAMap);
DECLARE_INSTANCE(SHAMapItem);
DECLARE_INSTANCE(SHAMapTreeNode);
void SHAMapNode::setHash() const
void SHAMapNode::setMHash() const
{
std::size_t h = theApp->getNonceST() + (mDepth * 0x9e3779b9);
const unsigned int *ptr = reinterpret_cast<const unsigned int *>(mNodeID.begin());
@@ -36,7 +36,7 @@ void SHAMapNode::setHash() const
std::size_t hash_value(const SHAMapNode& mn)
{
return mn.getHash();
return mn.getMHash();
}
std::size_t hash_value(const uint256& u)

View File

@@ -35,7 +35,7 @@ private:
int mDepth;
mutable size_t mHash;
void setHash() const;
void setMHash() const;
protected:
SHAMapNode(int depth, const uint256& id, bool) : mNodeID(id), mDepth(depth), mHash(0) { ; }
@@ -51,7 +51,7 @@ public:
const uint256& getNodeID() const { return mNodeID; }
bool isValid() const { return (mDepth >= 0) && (mDepth < 64); }
bool isRoot() const { return mDepth == 0; }
size_t getHash() const { if (mHash == 0) setHash(); return mHash; }
size_t getMHash() const { if (mHash == 0) setMHash(); return mHash; }
virtual bool isPopulated() const { return false; }

View File

@@ -97,7 +97,7 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
node->setFullBelow();
if (mType == smtSTATE)
{
fullBelowCache.add(node->getHash());
fullBelowCache.add(node->getNodeHash());
dropBelow(node);
}
}
@@ -162,7 +162,7 @@ std::vector<uint256> SHAMap::getNeededHashes(int max)
node->setFullBelow();
if (mType == smtSTATE)
{
fullBelowCache.add(node->getHash());
fullBelowCache.add(node->getNodeHash());
dropBelow(node);
}
}