mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 14:35:52 +00:00
Pathfinding now verifies source and destination accounts exist.
This commit is contained in:
@@ -193,9 +193,31 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
|
||||
% RippleAddress::createHumanAccountID(mSrcIssuerID)
|
||||
);
|
||||
|
||||
if (mLedger)
|
||||
if (!mLedger)
|
||||
{
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths< no ledger"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
LedgerEntrySet lesActive(mLedger);
|
||||
|
||||
SLE::pointer sleSrc = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(mSrcAccountID));
|
||||
if (!sleSrc)
|
||||
{
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths< no source"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
SLE::pointer sleDst = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(mDstAccountID));
|
||||
if (!sleDst)
|
||||
{
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths< no dest"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<STPath> vspResults;
|
||||
std::queue<STPath> qspExplore; // Path stubs to explore.
|
||||
|
||||
@@ -359,13 +381,13 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
|
||||
|
||||
// Create new paths for each outbound account not already in the path.
|
||||
AccountItems rippleLines(speEnd.mAccountID, mLedger, AccountItem::pointer(new RippleState()));
|
||||
SLE::pointer sleSrc = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(speEnd.mAccountID));
|
||||
SLE::pointer sleEnd = lesActive.entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(speEnd.mAccountID));
|
||||
|
||||
tLog(sleSrc, lsDEBUG)
|
||||
tLog(sleEnd, lsDEBUG)
|
||||
<< boost::str(boost::format("findPaths: account without root: %s")
|
||||
% RippleAddress::createHumanAccountID(speEnd.mAccountID));
|
||||
|
||||
bool bRequireAuth = isSetBit(sleSrc->getFieldU32(sfFlags), lsfRequireAuth);
|
||||
bool bRequireAuth = isSetBit(sleEnd->getFieldU32(sfFlags), lsfRequireAuth);
|
||||
|
||||
BOOST_FOREACH(AccountItem::ref item, rippleLines.getItems())
|
||||
{
|
||||
@@ -532,11 +554,6 @@ bool Pathfinder::findPaths(const unsigned int iMaxSteps, const unsigned int iMax
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths: RESULTS: non-defaults filtered away"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths: no ledger"));
|
||||
}
|
||||
|
||||
cLog(lsDEBUG) << boost::str(boost::format("findPaths< bFound=%d") % bFound);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user