mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix some mishandling of genesis block close timing.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ private:
|
||||
uint16 mLedgerInterval;
|
||||
bool mClosed, mValidHash, mAccepted, mImmutable;
|
||||
|
||||
static uint64 sGenesisClose;
|
||||
|
||||
SHAMap::pointer mTransactionMap, mAccountStateMap;
|
||||
|
||||
mutable boost::recursive_mutex mLock;
|
||||
|
||||
@@ -824,6 +824,7 @@ void LedgerConsensus::accept(SHAMap::pointer set)
|
||||
|
||||
if (mValidating)
|
||||
{
|
||||
assert (theApp->getOPs().getNetworkTimeNC() > newLCL->getCloseTimeNC());
|
||||
SerializedValidation::pointer v = boost::make_shared<SerializedValidation>
|
||||
(newLCLHash, newLCL->getCloseTimeNC(), mOurPosition->peekSeed(), true);
|
||||
v->setTrusted();
|
||||
|
||||
@@ -15,7 +15,7 @@ bool ValidationCollection::addValidation(SerializedValidation::pointer val)
|
||||
if ((now > valClose) && (now < (valClose + 2 * LEDGER_INTERVAL)))
|
||||
isTrusted = true;
|
||||
else
|
||||
Log(lsWARNING) << "Received stale validation";
|
||||
Log(lsWARNING) << "Received stale validation now=" << now << ", close=" << valClose;
|
||||
}
|
||||
|
||||
uint256 hash = val->getLedgerHash();
|
||||
|
||||
Reference in New Issue
Block a user