More fetch fixes.

This commit is contained in:
JoelKatz
2013-04-25 13:28:55 -07:00
parent cc9268ac79
commit c785bb3673
4 changed files with 8 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ LedgerAcquire::LedgerAcquire(const uint256& hash, uint32 seq) : PeerSet(hash, LE
void LedgerAcquire::checkLocal() void LedgerAcquire::checkLocal()
{ {
boost::recursive_mutex::scoped_lock sl(mLock); boost::recursive_mutex::scoped_lock sl(mLock);
if (mComplete) if (isDone())
return; return;
if (tryLocal()) if (tryLocal())

View File

@@ -265,7 +265,7 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
{ {
typedef std::pair<uint32, uint256> u_pair; typedef std::pair<uint32, uint256> u_pair;
std::vector<u_pair> vec = origLedger->getLedgerHashes(); std::vector<u_pair> vec = origLedger->getLedgerHashes();
BOOST_FOREACH(const u_pair& it, vec) BOOST_REVERSE_FOREACH(const u_pair& it, vec)
{ {
if ((fetchCount < fetchMax) && (it.first < ledgerSeq) && if ((fetchCount < fetchMax) && (it.first < ledgerSeq) &&
!mCompleteLedgers.hasValue(it.first) && !theApp->getMasterLedgerAcquire().find(it.second)) !mCompleteLedgers.hasValue(it.first) && !theApp->getMasterLedgerAcquire().find(it.second))
@@ -277,7 +277,8 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
setFullLedger(acq->getLedger()); setFullLedger(acq->getLedger());
mLedgerHistory.addAcceptedLedger(acq->getLedger(), false); mLedgerHistory.addAcceptedLedger(acq->getLedger(), false);
} }
else ++fetchCount; else
++fetchCount;
} }
} }
} }

View File

@@ -733,6 +733,8 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui
void SHAMap::fetchRoot(const uint256& hash, SHAMapSyncFilter* filter) void SHAMap::fetchRoot(const uint256& hash, SHAMapSyncFilter* filter)
{ {
if (hash == root->getNodeHash())
return;
if (sLog(lsTRACE)) if (sLog(lsTRACE))
{ {
if (mType == smtTRANSACTION) if (mType == smtTRANSACTION)

View File

@@ -136,13 +136,13 @@ std::vector<uint256> SHAMap::getNeededHashes(int max, SHAMapSyncFilter* filter)
if (!node->isEmptyBranch(branch)) if (!node->isEmptyBranch(branch))
{ {
const uint256& childHash = node->getChildHash(branch); const uint256& childHash = node->getChildHash(branch);
SHAMapNode childID = node->getChildNodeID(branch);
if (!fullBelowCache.isPresent(childHash)) if (!fullBelowCache.isPresent(childHash))
{ {
SHAMapNode childID = node->getChildNodeID(branch);
SHAMapTreeNode* d = NULL; SHAMapTreeNode* d = NULL;
try try
{ {
d = getNodePointer(node->getChildNodeID(branch), childHash); d = getNodePointer(childID, childHash);
assert(d); assert(d);
} }
catch (SHAMapMissingNode&) catch (SHAMapMissingNode&)