mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix a case where the AcceptedLedger constructor throws
This commit is contained in:
@@ -576,7 +576,20 @@ void Ledger::saveValidatedLedger (bool current)
|
||||
getApp().getNodeStore ().store (hotLEDGER, mLedgerSeq, s.modData (), mHash);
|
||||
}
|
||||
|
||||
AcceptedLedger::pointer aLedger = AcceptedLedger::makeAcceptedLedger (shared_from_this ());
|
||||
AcceptedLedger::pointer aLedger;
|
||||
try
|
||||
{
|
||||
aLedger = AcceptedLedger::makeAcceptedLedger (shared_from_this ());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
WriteLog (lsWARNING, Ledger) << "An accepted ledger was missing nodes";
|
||||
getApp().getLedgerMaster().failedSave(mLedgerSeq, mHash);
|
||||
{ // Clients can now trust the database for information about this ledger sequence
|
||||
StaticScopedLockType sl (sPendingSaveLock, __FILE__, __LINE__);
|
||||
sPendingSaves.erase(getLedgerSeq());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
DeprecatedScopedLock sl (getApp().getLedgerDB ()->getDBLock ());
|
||||
|
||||
@@ -532,6 +532,12 @@ void LedgerMaster::setFullLedger (Ledger::pointer ledger, bool isSynchronous, bo
|
||||
//--------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
void LedgerMaster::failedSave(uint32 seq, uint256 const& hash)
|
||||
{
|
||||
clearLedger(seq);
|
||||
getApp().getInboundLedgers().findCreate(hash, seq, true);
|
||||
}
|
||||
|
||||
void LedgerMaster::checkAccept (uint256 const& hash)
|
||||
{
|
||||
Ledger::pointer ledger = mLedgerHistory.getLedgerByHash (hash);
|
||||
|
||||
@@ -119,6 +119,8 @@ public:
|
||||
|
||||
void switchLedgers (Ledger::pointer lastClosed, Ledger::pointer newCurrent);
|
||||
|
||||
void failedSave(uint32 seq, uint256 const& hash);
|
||||
|
||||
std::string getCompleteLedgers ()
|
||||
{
|
||||
ScopedLockType sl (mCompleteLock, __FILE__, __LINE__);
|
||||
|
||||
Reference in New Issue
Block a user