From 5be33a650dcd4a301280f0c1b7950206e487af2c Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 26 Aug 2016 11:35:53 -0700 Subject: [PATCH] Report ledger information in account_lines RPC (RIPD-1276) --- src/ripple/rpc/handlers/AccountLines.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ripple/rpc/handlers/AccountLines.cpp b/src/ripple/rpc/handlers/AccountLines.cpp index ff7850213..1044914e6 100644 --- a/src/ripple/rpc/handlers/AccountLines.cpp +++ b/src/ripple/rpc/handlers/AccountLines.cpp @@ -93,9 +93,12 @@ Json::Value doAccountLines (RPC::Context& context) std::string strIdent (params[jss::account].asString ()); AccountID accountID; - // Intentional assignment in if. Extra parentheses silence warning. - if ((result = RPC::accountFromString (accountID, strIdent))) + if (auto jv = RPC::accountFromString (accountID, strIdent)) + { + for (auto it = jv.begin (); it != jv.end (); ++it) + result[it.memberName ()] = *it; return result; + } if (! ledger->exists(keylet::account (accountID))) return rpcError (rpcACT_NOT_FOUND); @@ -108,9 +111,12 @@ Json::Value doAccountLines (RPC::Context& context) AccountID raPeerAccount; if (hasPeer) { - // Intentional assignment in if. Extra parentheses silence warning. - if ((result = RPC::accountFromString (raPeerAccount, strPeer))) + if (auto jv = RPC::accountFromString (raPeerAccount, strPeer)) + { + for (auto it = jv.begin (); it != jv.end (); ++it) + result[it.memberName ()] = *it; return result; + } } unsigned int limit;