Fix some mishandling of genesis block close timing.

This commit is contained in:
JoelKatz
2012-06-20 13:40:10 -07:00
parent 796e1443c6
commit 94bc059f87
4 changed files with 12 additions and 3 deletions

View File

@@ -463,12 +463,18 @@ void Ledger::setCloseTime(boost::posix_time::ptime ptm)
mCloseTime = iToSeconds(ptm);
}
uint64 Ledger::sGenesisClose = 0;
uint64 Ledger::getNextLedgerClose() const
{
if (mCloseTime == 0)
{
uint64 closeTime = theApp->getOPs().getNetworkTimeNC() + mLedgerInterval - 1;
return closeTime - (closeTime % mLedgerInterval);
if (sGenesisClose == 0)
{
uint64 closeTime = theApp->getOPs().getNetworkTimeNC() + mLedgerInterval - 1;
sGenesisClose = closeTime - (closeTime % mLedgerInterval);
}
return sGenesisClose;
}
return mCloseTime + mLedgerInterval;
}