From 72ee15afe901c6a5db5d58fa4aaede475bb2d1b8 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 17 Feb 2013 16:49:57 -0800 Subject: [PATCH] Improve account_tx. Better performance, identify fully-validated transactions. --- src/cpp/ripple/RPCHandler.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 919843d35..6091c90c3 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1567,18 +1567,26 @@ Json::Value RPCHandler::doAccountTransactions(Json::Value jvRequest) try { #endif + int vl = theApp->getOPs().getValidatedSeq(); + ScopedUnlock su(theApp->getMasterLock()); + std::vector< std::pair > txns = mNetOps->getAccountTxs(raAccount, minLedger, maxLedger); Json::Value ret(Json::objectValue); ret["account"] = raAccount.humanAccountID(); Json::Value ledgers(Json::arrayValue); - // uint32 currentLedger = 0; for (std::vector< std::pair >::iterator it = txns.begin(), end = txns.end(); it != end; ++it) { Json::Value obj(Json::objectValue); - if (it->first) obj["tx"] = it->first->getJson(1); - if (it->second) obj["meta"] = it->second->getJson(0); + if (it->first) + obj["tx"] = it->first->getJson(1); + if (it->second) + { + obj["meta"] = it->second->getJson(0); + uint32 s = it->second->getLgrSeq(); + obj["validated"] = (s <= vl) && theApp->getOPs().haveLedger(s); + } ret["transactions"].append(obj); }