Remove mLedger from PathState. It's not used and it's scary (because an LES could amend it).

This commit is contained in:
JoelKatz
2013-04-13 19:17:32 -07:00
parent 1f5d380546
commit 199029b8b5
3 changed files with 8 additions and 11 deletions

View File

@@ -88,7 +88,7 @@ bool Pathfinder::bDefaultPath(const STPath& spPath)
return false; // Didn't generate a default path. So can't match. return false; // Didn't generate a default path. So can't match.
} }
PathState::pointer pspCurrent = boost::make_shared<PathState>(mDstAmount, mSrcAmount, mLedger); PathState::pointer pspCurrent = boost::make_shared<PathState>(mDstAmount, mSrcAmount);
if (pspCurrent) if (pspCurrent)
{ {
@@ -163,7 +163,7 @@ Pathfinder::Pathfinder(Ledger::ref ledger,
// Construct the default path for later comparison. // Construct the default path for later comparison.
PathState::pointer psDefault = boost::make_shared<PathState>(mDstAmount, mSrcAmount, mLedger); PathState::pointer psDefault = boost::make_shared<PathState>(mDstAmount, mSrcAmount);
if (psDefault) if (psDefault)
{ {

View File

@@ -2676,7 +2676,7 @@ TER RippleCalc::rippleCalc(
// Build a default path. Use saDstAmountReq and saMaxAmountReq to imply nodes. // Build a default path. Use saDstAmountReq and saMaxAmountReq to imply nodes.
// XXX Might also make a XRP bridge by default. // XXX Might also make a XRP bridge by default.
PathState::pointer pspDirect = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq, lesActive.getLedgerRef()); PathState::pointer pspDirect = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq);
if (!pspDirect) if (!pspDirect)
return temUNKNOWN; return temUNKNOWN;
@@ -2706,10 +2706,10 @@ cLog(lsDEBUG) << boost::str(boost::format("rippleCalc: Build direct: status: %s"
cLog(lsTRACE) << "rippleCalc: Paths in set: " << spsPaths.size(); cLog(lsTRACE) << "rippleCalc: Paths in set: " << spsPaths.size();
int iIndex = 0; int iIndex = 0;
BOOST_FOREACH(const STPath& spPath, spsPaths) BOOST_FOREACH(const STPath& spPath, spsPaths)
{ {
PathState::pointer pspExpanded = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq, lesActive.getLedgerRef()); PathState::pointer pspExpanded = boost::make_shared<PathState>(saDstAmountReq, saMaxAmountReq);
if (!pspExpanded) if (!pspExpanded)
return temUNKNOWN; return temUNKNOWN;

View File

@@ -71,8 +71,6 @@ extern std::size_t hash_value(const aciSource& asValue);
class PathState class PathState
{ {
protected: protected:
Ledger::pointer mLedger;
TER pushNode(const int iType, const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID); TER pushNode(const int iType, const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
TER pushImply(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID); TER pushImply(const uint160& uAccountID, const uint160& uCurrencyID, const uint160& uIssuerID);
@@ -116,12 +114,11 @@ public:
PathState( PathState(
const STAmount& saSend, const STAmount& saSend,
const STAmount& saSendMax, const STAmount& saSendMax
Ledger::pointer lrLedger = Ledger::pointer() ) : saInReq(saSendMax), saOutReq(saSend) { ; }
) : mLedger(lrLedger), saInReq(saSendMax), saOutReq(saSend) { ; }
PathState(const PathState& psSrc, bool bUnused) PathState(const PathState& psSrc, bool bUnused)
: mLedger(psSrc.mLedger), saInReq(psSrc.saInReq), saOutReq(psSrc.saOutReq) { ; } : saInReq(psSrc.saInReq), saOutReq(psSrc.saOutReq) { ; }
void setExpanded( void setExpanded(
const LedgerEntrySet& lesSource, const LedgerEntrySet& lesSource,