Don't produce any paths where the input and output are the same account, same currency.

This commit is contained in:
JoelKatz
2013-04-08 19:18:29 -07:00
parent 859ff7784d
commit a132df0535
3 changed files with 15 additions and 6 deletions

View File

@@ -129,7 +129,7 @@ bool candCmp(uint32 seq, const candidate_t& first, const candidate_t& second)
Pathfinder::Pathfinder(Ledger::ref ledger,
const RippleAddress& uSrcAccountID, const RippleAddress& uDstAccountID,
const uint160& uSrcCurrencyID, const uint160& uSrcIssuerID, const STAmount& saDstAmount)
const uint160& uSrcCurrencyID, const uint160& uSrcIssuerID, const STAmount& saDstAmount, bool bValid)
: mSrcAccountID(uSrcAccountID.getAccountID()),
mDstAccountID(uDstAccountID.getAccountID()),
mDstAmount(saDstAmount),
@@ -139,6 +139,13 @@ Pathfinder::Pathfinder(Ledger::ref ledger,
mLedger(ledger)
{
if ((mSrcAccountID == mDstAccountID) && (mSrcCurrencyID == mDstAmount.getCurrency()))
{ // no need to send to same account with same currency
bValid = false;
return;
}
bValid = true;
theApp->getOrderBookDB().setup(mLedger);
mLoadMonitor = theApp->getJobQueue().getLoadEvent(jtPATH_FIND, "FindPath");