mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
First part of fetch acceleration changes. Includes a bugfix that I'll push to master.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -172,6 +172,38 @@ std::vector<uint256> SHAMap::getNeededHashes(int max)
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::list< std::pair<uint256, std::vector<unsigned char> > >
|
||||
getSyncInfo(SHAMap::pointer have, SHAMap::pointer want, int max)
|
||||
{
|
||||
std::list< std::pair< uint256, std::vector<unsigned char> > > ret;
|
||||
SHAMapIterator haveI(*have, true, false);
|
||||
SHAMapIterator wantI(*want, true, false);
|
||||
SHAMapTreeNode *haveN = haveI.getNext();
|
||||
SHAMapTreeNode *wantN = wantI.getNext();
|
||||
while (wantN != NULL)
|
||||
{
|
||||
if (haveN && (haveN->getNodeHash() == wantN->getNodeHash()))
|
||||
{ // they match, advance both
|
||||
haveN = haveI.getNext();
|
||||
wantN = wantI.getNext();
|
||||
}
|
||||
else if (haveN && (haveN->getNodeHash() < wantN->getNodeHash()))
|
||||
{ // need to advance have pointer
|
||||
haveN = haveI.getNext();
|
||||
}
|
||||
else
|
||||
{ // unmatched inner node
|
||||
Serializer s;
|
||||
wantN->addRaw(s, snfPREFIX);
|
||||
ret.push_back(std::make_pair(wantN->getNodeHash(), s.peekData()));
|
||||
if (--max <= 0)
|
||||
break;
|
||||
wantN = wantI.getNext();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool SHAMap::getNodeFat(const SHAMapNode& wanted, std::vector<SHAMapNode>& nodeIDs,
|
||||
std::list<std::vector<unsigned char> >& rawNodes, bool fatRoot, bool fatLeaves)
|
||||
{ // Gets a node and some of its children
|
||||
|
||||
Reference in New Issue
Block a user