From 9be7b9cc3f182a1cf226029d9e6e6ca9d2510671 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 14 May 2013 18:38:36 -0700 Subject: [PATCH] doBookOffers optimizations. --- src/cpp/ripple/RPCHandler.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index d44d780716..aa185cfedc 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1202,12 +1202,15 @@ Json::Value RPCHandler::doBookOffers(Json::Value jvRequest, int& cost, ScopedLoc if (!lpLedger) return jvResult; + if (lpLedger->isImmutable()) + MasterLockHolder.unlock(); + if (!jvRequest.isMember("taker_pays") || !jvRequest.isMember("taker_gets") || !jvRequest["taker_pays"].isObject() || !jvRequest["taker_gets"].isObject()) return rpcError(rpcINVALID_PARAMS); - uint160 uTakerPaysCurrencyID; - uint160 uTakerPaysIssuerID; - Json::Value jvTakerPays = jvRequest["taker_pays"]; + uint160 uTakerPaysCurrencyID; + uint160 uTakerPaysIssuerID; + const Json::Value& jvTakerPays = jvRequest["taker_pays"]; // Parse mandatory currency. if (!jvTakerPays.isMember("currency") @@ -1230,9 +1233,9 @@ Json::Value RPCHandler::doBookOffers(Json::Value jvRequest, int& cost, ScopedLoc return rpcError(rpcSRC_ISR_MALFORMED); } - uint160 uTakerGetsCurrencyID; - uint160 uTakerGetsIssuerID; - Json::Value jvTakerGets = jvRequest["taker_gets"]; + uint160 uTakerGetsCurrencyID; + uint160 uTakerGetsIssuerID; + const Json::Value& jvTakerGets = jvRequest["taker_gets"]; // Parse mandatory currency. if (!jvTakerGets.isMember("currency")