Make getLedgerByHash(0) return the current ledger.

This commit is contained in:
Arthur Britto
2012-09-26 15:02:17 -07:00
parent f3f116117a
commit be54bf070c

View File

@@ -66,10 +66,15 @@ public:
Ledger::pointer getLedgerByHash(const uint256& hash)
{
if (!hash)
return mCurrentLedger;
if (mCurrentLedger && (mCurrentLedger->getHash() == hash))
return mCurrentLedger;
if (mFinalizedLedger && (mFinalizedLedger->getHash() == hash))
return mFinalizedLedger;
return mLedgerHistory.getLedgerByHash(hash);
}