Helper function.

This commit is contained in:
JoelKatz
2013-01-01 18:16:57 -08:00
parent db9897f12f
commit 4d6f04ed2f

View File

@@ -41,6 +41,16 @@ void LedgerHistory::addAcceptedLedger(Ledger::pointer ledger, bool fromConsensus
ledger->pendSave(fromConsensus);
}
uint256 LedgerHistory::getLedgerHash(uint32 index)
{
boost::recursive_mutex::scoped_lock sl(mLedgersByHash.peekMutex());
std::map<uint32, uint256>::iterator it(mLedgersByIndex.find(index));
if (it != mLedgersByIndex.end())
return it->second;
sl.unlock();
return uint256();
}
Ledger::pointer LedgerHistory::getLedgerBySeq(uint32 index)
{
boost::recursive_mutex::scoped_lock sl(mLedgersByHash.peekMutex());