mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-02 16:35:49 +00:00
Keep SHAMapNodes that fault in handling client requests.
This commit is contained in:
committed by
Nik Bougalis
parent
66a762d504
commit
6f2bcc6fb0
@@ -1785,7 +1785,7 @@ private:
|
|||||||
mCloseTime = getApp().getOPs ().getCloseTimeNC ();
|
mCloseTime = getApp().getOPs ().getCloseTimeNC ();
|
||||||
getApp().getOPs ().setLastCloseTime (mCloseTime);
|
getApp().getOPs ().setLastCloseTime (mCloseTime);
|
||||||
statusChange (protocol::neCLOSING_LEDGER, *mPreviousLedger);
|
statusChange (protocol::neCLOSING_LEDGER, *mPreviousLedger);
|
||||||
getApp().getLedgerMaster().closeLedger (true);
|
getApp().getLedgerMaster().applyHeldTransactions ();
|
||||||
takeInitialPosition (*getApp().getLedgerMaster ().getCurrentLedger ());
|
takeInitialPosition (*getApp().getLedgerMaster ().getCurrentLedger ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ Ledger::Ledger (const RippleAddress& masterID, std::uint64_t startAmount)
|
|||||||
|
|
||||||
writeBack (lepCREATE, startAccount->getSLE ());
|
writeBack (lepCREATE, startAccount->getSLE ());
|
||||||
|
|
||||||
mAccountStateMap->flushDirty (*mAccountStateMap->disarmDirty (), 256,
|
auto dirtyNodes = mAccountStateMap->disarmDirty();
|
||||||
hotACCOUNT_NODE, mLedgerSeq);
|
mAccountStateMap->flushDirty (*dirtyNodes, 256, hotACCOUNT_NODE, mLedgerSeq);
|
||||||
|
|
||||||
initializeFees ();
|
initializeFees ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ public:
|
|||||||
|
|
||||||
LockType m_mutex;
|
LockType m_mutex;
|
||||||
|
|
||||||
TransactionEngine mEngine;
|
|
||||||
|
|
||||||
LedgerHolder mCurrentLedger; // The ledger we are currently processiong
|
LedgerHolder mCurrentLedger; // The ledger we are currently processiong
|
||||||
LedgerHolder mClosedLedger; // The ledger that most recently closed
|
LedgerHolder mClosedLedger; // The ledger that most recently closed
|
||||||
LedgerHolder mValidLedger; // The highest-sequence ledger we have fully accepted
|
LedgerHolder mValidLedger; // The highest-sequence ledger we have fully accepted
|
||||||
@@ -212,7 +210,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
mCurrentLedger.set (newLedger);
|
mCurrentLedger.set (newLedger);
|
||||||
mEngine.setLedger (newLedger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().RUN_STANDALONE)
|
if (getConfig().RUN_STANDALONE)
|
||||||
@@ -234,7 +231,6 @@ public:
|
|||||||
ScopedLockType ml (m_mutex);
|
ScopedLockType ml (m_mutex);
|
||||||
mClosedLedger.set (newLCL);
|
mClosedLedger.set (newLCL);
|
||||||
mCurrentLedger.set (newOL);
|
mCurrentLedger.set (newOL);
|
||||||
mEngine.setLedger (newOL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().RUN_STANDALONE)
|
if (getConfig().RUN_STANDALONE)
|
||||||
@@ -263,7 +259,6 @@ public:
|
|||||||
mClosedLedger.set (lastClosed);
|
mClosedLedger.set (lastClosed);
|
||||||
|
|
||||||
assert (!current->isClosed ());
|
assert (!current->isClosed ());
|
||||||
mEngine.setLedger (current);
|
|
||||||
}
|
}
|
||||||
checkAccept (lastClosed);
|
checkAccept (lastClosed);
|
||||||
}
|
}
|
||||||
@@ -285,50 +280,51 @@ public:
|
|||||||
setFullLedger(ledger, true, false);
|
setFullLedger(ledger, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeLedger (bool recover)
|
/** Apply held transactions to the open ledger
|
||||||
|
This is normally called as we close the ledger.
|
||||||
|
The open ledger remains open to handle new transactions
|
||||||
|
until a new open ledger is built.
|
||||||
|
*/
|
||||||
|
void applyHeldTransactions ()
|
||||||
{
|
{
|
||||||
ScopedLockType sl (m_mutex);
|
ScopedLockType sl (m_mutex);
|
||||||
Ledger::pointer closingLedger = mCurrentLedger.getMutable ();
|
|
||||||
|
|
||||||
if (recover)
|
// Start with a mutable snapshot of the open ledger
|
||||||
|
TransactionEngine engine (mCurrentLedger.getMutable ());
|
||||||
|
|
||||||
|
int recovers = 0;
|
||||||
|
|
||||||
|
for (auto const& it : mHeldTransactions)
|
||||||
{
|
{
|
||||||
int recovers = 0;
|
try
|
||||||
|
|
||||||
for (CanonicalTXSet::iterator it = mHeldTransactions.begin (), end = mHeldTransactions.end (); it != end; ++it)
|
|
||||||
{
|
{
|
||||||
try
|
TransactionEngineParams tepFlags = tapOPEN_LEDGER;
|
||||||
{
|
|
||||||
TransactionEngineParams tepFlags = tapOPEN_LEDGER;
|
|
||||||
|
|
||||||
if (getApp().getHashRouter ().addSuppressionFlags (it->first.getTXID (), SF_SIGGOOD))
|
if (getApp().getHashRouter ().addSuppressionFlags (it.first.getTXID (), SF_SIGGOOD))
|
||||||
tepFlags = static_cast<TransactionEngineParams> (tepFlags | tapNO_CHECK_SIGN);
|
tepFlags = static_cast<TransactionEngineParams> (tepFlags | tapNO_CHECK_SIGN);
|
||||||
|
|
||||||
bool didApply;
|
bool didApply;
|
||||||
mEngine.applyTransaction (*it->second, tepFlags, didApply);
|
engine.applyTransaction (*it.second, tepFlags, didApply);
|
||||||
|
|
||||||
if (didApply)
|
if (didApply)
|
||||||
++recovers;
|
++recovers;
|
||||||
|
|
||||||
// If a transaction is recovered but hasn't been relayed,
|
// If a transaction is recovered but hasn't been relayed,
|
||||||
// it will become disputed in the consensus process, which
|
// it will become disputed in the consensus process, which
|
||||||
// will cause it to be relayed.
|
// will cause it to be relayed.
|
||||||
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
// CHECKME: We got a few of these
|
|
||||||
WriteLog (lsWARNING, LedgerMaster) << "Held transaction throws";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (...)
|
||||||
CondLog (recovers != 0, lsINFO, LedgerMaster) << "Recovered " << recovers << " held transactions";
|
{
|
||||||
|
WriteLog (lsWARNING, LedgerMaster) << "Held transaction throws";
|
||||||
// VFALCO TODO recreate the CanonicalTxSet object instead of resetting it
|
}
|
||||||
mHeldTransactions.reset (closingLedger->getHash ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrentLedger.set (closingLedger);
|
CondLog (recovers != 0, lsINFO, LedgerMaster) << "Recovered " << recovers << " held transactions";
|
||||||
mEngine.setLedger (mCurrentLedger.getMutable ());
|
|
||||||
|
// VFALCO TODO recreate the CanonicalTxSet object instead of resetting it
|
||||||
|
mHeldTransactions.reset (engine.getLedger()->getHash ());
|
||||||
|
mCurrentLedger.set (engine.getLedger ());
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerIndex getBuildingLedger ()
|
LedgerIndex getBuildingLedger ()
|
||||||
@@ -345,12 +341,15 @@ public:
|
|||||||
TER doTransaction (SerializedTransaction::ref txn, TransactionEngineParams params, bool& didApply)
|
TER doTransaction (SerializedTransaction::ref txn, TransactionEngineParams params, bool& didApply)
|
||||||
{
|
{
|
||||||
Ledger::pointer ledger;
|
Ledger::pointer ledger;
|
||||||
|
TransactionEngine engine;
|
||||||
TER result;
|
TER result;
|
||||||
|
didApply = false;
|
||||||
|
|
||||||
{
|
{
|
||||||
ScopedLockType sl (m_mutex);
|
ScopedLockType sl (m_mutex);
|
||||||
result = mEngine.applyTransaction (*txn, params, didApply);
|
ledger = mCurrentLedger.getMutable ();
|
||||||
ledger = mEngine.getLedger ();
|
engine.setLedger (ledger);
|
||||||
|
result = engine.applyTransaction (*txn, params, didApply);
|
||||||
}
|
}
|
||||||
if (didApply)
|
if (didApply)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
|
|
||||||
virtual std::string getCompleteLedgers () = 0;
|
virtual std::string getCompleteLedgers () = 0;
|
||||||
|
|
||||||
virtual void closeLedger (bool recoverHeldTransactions) = 0;
|
virtual void applyHeldTransactions () = 0;
|
||||||
|
|
||||||
/** Get a ledger's hash by sequence number using the cache
|
/** Get a ledger's hash by sequence number using the cache
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1135,9 +1135,12 @@ int SHAMap::flushDirty (DirtySet& set, int maxNodes, NodeObjectType t, std::uint
|
|||||||
|
|
||||||
getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash);
|
getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash);
|
||||||
|
|
||||||
// Put the canonical version into the SHAMap and the treeNodeCache
|
if (getApp().running ())
|
||||||
mTNByID.erase (*node);
|
{
|
||||||
fetchNodeExternal (*node, nodeHash);
|
// Put the canonical version into the SHAMap and the treeNodeCache
|
||||||
|
mTNByID.erase (*node);
|
||||||
|
fetchNodeExternal (*node, nodeHash);
|
||||||
|
}
|
||||||
|
|
||||||
if (flushed++ >= maxNodes)
|
if (flushed++ >= maxNodes)
|
||||||
return flushed;
|
return flushed;
|
||||||
|
|||||||
Reference in New Issue
Block a user