From 9aaabaebcdf31022c4a30f1566490943c07bc8ea Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 19 Aug 2013 23:36:26 -0700 Subject: [PATCH] Don't send full ledgers to non-admins when under load. --- modules/ripple_app/rpc/RPCHandler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ripple_app/rpc/RPCHandler.cpp b/modules/ripple_app/rpc/RPCHandler.cpp index ba5c10392d..340acbc5d6 100644 --- a/modules/ripple_app/rpc/RPCHandler.cpp +++ b/modules/ripple_app/rpc/RPCHandler.cpp @@ -1962,6 +1962,13 @@ Json::Value RPCHandler::doLedger (Json::Value params, LoadType* loadType, Applic | (bTransactions ? LEDGER_JSON_DUMP_TXRP : 0) | (bAccounts ? LEDGER_JSON_DUMP_STATE : 0); + if ((bFull || bAccounts) && getApp().getFeeTrack().isLoadedLocal() && (mRole != ADMIN)) + { + WriteLog (lsDEBUG, Peer) << "Too busy to give full ledger"; + return rpcError(rpcTOO_BUSY); + } + + Json::Value ret (Json::objectValue); lpLedger->addJson (ret, iOptions);