mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Map sync bugfix - wrong hash caused 'fullBelow' optimization to fail.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user