Startup and shutdown improvements. Performance improvements.

This commit is contained in:
JoelKatz
2013-03-03 02:09:19 -08:00
parent 0015716cb5
commit 51a85504a8
7 changed files with 70 additions and 10 deletions

View File

@@ -145,6 +145,8 @@ void LedgerMaster::asyncAccept(Ledger::pointer ledger)
uint32 seq = ledger->getLedgerSeq();
uint256 prevHash = ledger->getParentHash();
std::map< uint32, std::pair<uint256, uint256> > ledgerHashes;
while (seq > 0)
{
{
@@ -155,10 +157,20 @@ void LedgerMaster::asyncAccept(Ledger::pointer ledger)
break;
}
uint256 tHash, pHash;
if (!Ledger::getHashesByIndex(seq, tHash, pHash) || (tHash != prevHash))
std::map< uint32, std::pair<uint256, uint256> >::iterator it = ledgerHashes.find(seq);
if (it == ledgerHashes.end())
{
if (theApp->isShutdown())
return;
ledgerHashes = Ledger::getHashesByIndex((seq < 500) ? 0 : (seq - 499), seq);
it = ledgerHashes.find(seq);
if (it == ledgerHashes.end())
break;
}
if (it->second.first != prevHash)
break;
prevHash = pHash;
prevHash = it->second.second;
}
resumeAcquiring();