mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make sure we don't use an invalid LES. (Adds asserts.)
This commit is contained in:
@@ -78,6 +78,8 @@ public:
|
|||||||
LedgerEntrySet duplicate() const; // Make a duplicate of this set
|
LedgerEntrySet duplicate() const; // Make a duplicate of this set
|
||||||
void setTo(const LedgerEntrySet&); // Set this set to have the same contents as another
|
void setTo(const LedgerEntrySet&); // Set this set to have the same contents as another
|
||||||
void swapWith(LedgerEntrySet&); // Swap the contents of two sets
|
void swapWith(LedgerEntrySet&); // Swap the contents of two sets
|
||||||
|
void invalidate() { mLedger.reset(); }
|
||||||
|
bool isValid() const { return !!mLedger; }
|
||||||
|
|
||||||
int getSeq() const { return mSeq; }
|
int getSeq() const { return mSeq; }
|
||||||
TransactionEngineParams getParams() const { return mParams; }
|
TransactionEngineParams getParams() const { return mParams; }
|
||||||
|
|||||||
@@ -2649,6 +2649,7 @@ TER RippleCalc::rippleCalc(
|
|||||||
const bool bOpenLedger
|
const bool bOpenLedger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
assert(lesActive.isValid());
|
||||||
RippleCalc rc(lesActive, bOpenLedger);
|
RippleCalc rc(lesActive, bOpenLedger);
|
||||||
|
|
||||||
cLog(lsTRACE) << boost::str(boost::format("rippleCalc> saMaxAmountReq=%s saDstAmountReq=%s")
|
cLog(lsTRACE) << boost::str(boost::format("rippleCalc> saMaxAmountReq=%s saDstAmountReq=%s")
|
||||||
@@ -2807,7 +2808,10 @@ int iPass = 0;
|
|||||||
% pspCur->saInPass.getFullText()
|
% pspCur->saInPass.getFullText()
|
||||||
% pspCur->saOutPass.getFullText());
|
% pspCur->saOutPass.getFullText());
|
||||||
|
|
||||||
|
assert(lesActive.isValid());
|
||||||
lesActive.swapWith(pspCur->lesEntries); // For the path, save ledger state.
|
lesActive.swapWith(pspCur->lesEntries); // For the path, save ledger state.
|
||||||
|
lesActive.invalidate();
|
||||||
|
|
||||||
iBest = pspCur->getIndex();
|
iBest = pspCur->getIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2842,7 +2846,9 @@ int iPass = 0;
|
|||||||
vuUnfundedBecame.insert(vuUnfundedBecame.end(), pspBest->vUnfundedBecame.begin(), pspBest->vUnfundedBecame.end());
|
vuUnfundedBecame.insert(vuUnfundedBecame.end(), pspBest->vUnfundedBecame.begin(), pspBest->vUnfundedBecame.end());
|
||||||
|
|
||||||
// Record best pass' LedgerEntrySet to build off of and potentially return.
|
// Record best pass' LedgerEntrySet to build off of and potentially return.
|
||||||
|
assert(pspBest->lesEntries.isValid());
|
||||||
lesActive.swapWith(pspBest->lesEntries);
|
lesActive.swapWith(pspBest->lesEntries);
|
||||||
|
pspBest->lesEntries.invalidate();
|
||||||
|
|
||||||
saMaxAmountAct += pspBest->saInPass;
|
saMaxAmountAct += pspBest->saInPass;
|
||||||
saDstAmountAct += pspBest->saOutPass;
|
saDstAmountAct += pspBest->saOutPass;
|
||||||
|
|||||||
Reference in New Issue
Block a user