mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Ensure all dirty SHA nodes are fully written before writing the ledger header.
To avoid a performance penalty, write accountstate nodes while we're waiting.
This commit is contained in:
@@ -375,12 +375,6 @@ void Ledger::saveAcceptedLedger()
|
||||
{ cLog(lsINFO) << "Flushed " << fc << " dirty state nodes"; }
|
||||
disarmDirty();
|
||||
|
||||
theApp->getLedgerDB()->getDB()->executeSQL(boost::str(addLedger %
|
||||
getHash().GetHex() % mLedgerSeq % mParentHash.GetHex() %
|
||||
boost::lexical_cast<std::string>(mTotCoins) % mCloseTime % mParentCloseTime %
|
||||
mCloseResolution % mCloseFlags %
|
||||
mAccountHash.GetHex() % mTransHash.GetHex()));
|
||||
|
||||
SHAMap& txSet = *peekTransactionMap();
|
||||
Database *db = theApp->getTxnDB()->getDB();
|
||||
ScopedLock dbLock = theApp->getTxnDB()->getDBLock();
|
||||
@@ -437,6 +431,13 @@ void Ledger::saveAcceptedLedger()
|
||||
}
|
||||
}
|
||||
db->executeSQL("COMMIT TRANSACTION;");
|
||||
|
||||
theApp->getHashedObjectStore().waitWrite(); // wait until all nodes are written
|
||||
theApp->getLedgerDB()->getDB()->executeSQL(boost::str(addLedger %
|
||||
getHash().GetHex() % mLedgerSeq % mParentHash.GetHex() %
|
||||
boost::lexical_cast<std::string>(mTotCoins) % mCloseTime % mParentCloseTime %
|
||||
mCloseResolution % mCloseFlags %
|
||||
mAccountHash.GetHex() % mTransHash.GetHex()));
|
||||
}
|
||||
|
||||
theApp->getOPs().pubLedger(shared_from_this());
|
||||
|
||||
Reference in New Issue
Block a user