Remove limits on RPC account_tx for admins.

This commit is contained in:
Arthur Britto
2013-03-23 14:36:07 -07:00
parent 4ac824419a
commit 837ec2b69d
3 changed files with 12 additions and 11 deletions

View File

@@ -1060,16 +1060,16 @@ void NetworkOPs::setMode(OperatingMode om)
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
NetworkOPs::getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger) NetworkOPs::getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger, bool bAdmin)
{ // can be called with no locks { // can be called with no locks
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret; std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret;
std::string sql = std::string sql =
str(boost::format("SELECT AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta FROM " boost::str(boost::format("SELECT AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta FROM "
"AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID " "AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID "
"WHERE Account = '%s' AND AccountTransactions.LedgerSeq <= '%u' AND AccountTransactions.LedgerSeq >= '%u' " "WHERE Account = '%s' AND AccountTransactions.LedgerSeq <= '%u' AND AccountTransactions.LedgerSeq >= '%u' "
"ORDER BY AccountTransactions.LedgerSeq,AccountTransactions.TransID DESC LIMIT 200;") "ORDER BY AccountTransactions.LedgerSeq,AccountTransactions.TransID DESC%s;")
% account.humanAccountID() % maxLedger % minLedger); % account.humanAccountID() % maxLedger % minLedger % (bAdmin ? "" : " LIMIT 200"));
{ {
Database* db = theApp->getTxnDB()->getDB(); Database* db = theApp->getTxnDB()->getDB();
@@ -1098,15 +1098,15 @@ std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
} }
std::vector<NetworkOPs::txnMetaLedgerType> NetworkOPs::getAccountTxsB( std::vector<NetworkOPs::txnMetaLedgerType> NetworkOPs::getAccountTxsB(
const RippleAddress& account, uint32 minLedger, uint32 maxLedger) const RippleAddress& account, uint32 minLedger, uint32 maxLedger, bool bAdmin)
{ // can be called with no locks { // can be called with no locks
std::vector< txnMetaLedgerType> ret; std::vector< txnMetaLedgerType> ret;
std::string sql = str(boost::format("SELECT AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta FROM " std::string sql = str(boost::format("SELECT AccountTransactions.LedgerSeq,Status,RawTxn,TxnMeta FROM "
"AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID " "AccountTransactions INNER JOIN Transactions ON Transactions.TransID = AccountTransactions.TransID "
"WHERE Account = '%s' AND AccountTransactions.LedgerSeq <= '%u' AND AccountTransactions.LedgerSeq >= '%u' " "WHERE Account = '%s' AND AccountTransactions.LedgerSeq <= '%u' AND AccountTransactions.LedgerSeq >= '%u' "
"ORDER BY AccountTransactions.LedgerSeq,AccountTransactions.TransID DESC LIMIT 500;") "ORDER BY AccountTransactions.LedgerSeq,AccountTransactions.TransID DESC%s;")
% account.humanAccountID() % maxLedger % minLedger); % account.humanAccountID() % maxLedger % minLedger % (bAdmin ? "" : " LIMIT 500"));
{ {
Database* db = theApp->getTxnDB()->getDB(); Database* db = theApp->getTxnDB()->getDB();

View File

@@ -294,11 +294,11 @@ public:
// client information retrieval functions // client information retrieval functions
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger); getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger, bool bAdmin);
typedef boost::tuple<std::string, std::string, uint32> txnMetaLedgerType; typedef boost::tuple<std::string, std::string, uint32> txnMetaLedgerType;
std::vector<txnMetaLedgerType> std::vector<txnMetaLedgerType>
getAccountTxsB(const RippleAddress& account, uint32 minL, uint32 maxL); getAccountTxsB(const RippleAddress& account, uint32 minL, uint32 maxL, bool bAdmin);
std::vector<RippleAddress> getLedgerAffectedAccounts(uint32 ledgerSeq); std::vector<RippleAddress> getLedgerAffectedAccounts(uint32 ledgerSeq);
std::vector<SerializedTransaction> getLedgerTransactions(uint32 ledgerSeq); std::vector<SerializedTransaction> getLedgerTransactions(uint32 ledgerSeq);

View File

@@ -1706,7 +1706,8 @@ Json::Value RPCHandler::doAccountTransactions(Json::Value jvRequest, int& cost)
if (jvRequest.isMember("binary") && jvRequest["binary"].asBool()) if (jvRequest.isMember("binary") && jvRequest["binary"].asBool())
{ {
std::vector<NetworkOPs::txnMetaLedgerType> txns = std::vector<NetworkOPs::txnMetaLedgerType> txns =
mNetOps->getAccountTxsB(raAccount, minLedger, maxLedger); mNetOps->getAccountTxsB(raAccount, minLedger, maxLedger, mRole == ADMIN);
for (std::vector<NetworkOPs::txnMetaLedgerType>::const_iterator it = txns.begin(), end = txns.end(); for (std::vector<NetworkOPs::txnMetaLedgerType>::const_iterator it = txns.begin(), end = txns.end();
it != end; ++it) it != end; ++it)
{ {
@@ -1723,7 +1724,7 @@ Json::Value RPCHandler::doAccountTransactions(Json::Value jvRequest, int& cost)
} }
else else
{ {
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > txns = mNetOps->getAccountTxs(raAccount, minLedger, maxLedger); std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > txns = mNetOps->getAccountTxs(raAccount, minLedger, maxLedger, mRole == ADMIN);
for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin(), end = txns.end(); it != end; ++it) for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin(), end = txns.end(); it != end; ++it)
{ {
Json::Value obj(Json::objectValue); Json::Value obj(Json::objectValue);