From 505f029edb6f9c4bc627c815c09d2a5f8ce05b91 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 22 Jan 2014 23:05:39 -0800 Subject: [PATCH] Clean up 'destination_currencies' in new pathfinding reply --- src/ripple_app/paths/PathRequest.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ripple_app/paths/PathRequest.cpp b/src/ripple_app/paths/PathRequest.cpp index 3c7aafa03..86c6ef70f 100644 --- a/src/ripple_app/paths/PathRequest.cpp +++ b/src/ripple_app/paths/PathRequest.cpp @@ -122,7 +122,8 @@ bool PathRequest::isValid (Ledger::ref lrLedger) else { AccountState::pointer asDst = getApp().getOPs ().getAccountState (lrLedger, raDstAccount); - Json::Value jvDestCur; + + Json::Value& jvDestCur = (jvStatus["destination_currencies"] = Json::arrayValue); if (!asDst) { @@ -144,18 +145,23 @@ bool PathRequest::isValid (Ledger::ref lrLedger) } else { - boost::unordered_set usDestCurrID = usAccountDestCurrencies (raDstAccount, lrLedger, true); + bool includeXRP = !isSetBit (asDst->peekSLE ().getFlags(), lsfDisallowXRP); + boost::unordered_set usDestCurrID = + usAccountDestCurrencies (raDstAccount, lrLedger, includeXRP); + BOOST_FOREACH (const uint160 & uCurrency, usDestCurrID) - jvDestCur.append (STAmount::createHumanCurrency (uCurrency)); + jvDestCur.append (STAmount::createHumanCurrency (uCurrency)); + jvStatus["destination_tag"] = (asDst->peekSLE ().getFlags () & lsfRequireDestTag) != 0; } - - jvStatus["destination_currencies"] = jvDestCur; } } - jvStatus["ledger_hash"] = lrLedger->getHash ().GetHex (); - jvStatus["ledger_index"] = lrLedger->getLedgerSeq (); + if (bValid) + { + jvStatus["ledger_hash"] = lrLedger->getHash ().GetHex (); + jvStatus["ledger_index"] = lrLedger->getLedgerSeq (); + } return bValid; }