mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Begin deprecating the old account_tx interface.
This commit is contained in:
@@ -336,7 +336,6 @@ public:
|
||||
getTxsAccountB (const RippleAddress& account, int32 minLedger, int32 maxLedger, bool forward, Json::Value& token, int limit, bool bAdmin);
|
||||
|
||||
std::vector<RippleAddress> getLedgerAffectedAccounts (uint32 ledgerSeq);
|
||||
uint32 countAccountTxs (const RippleAddress& account, int32 minLedger, int32 maxLedger);
|
||||
|
||||
//
|
||||
// Monitoring: publisher side
|
||||
@@ -1837,24 +1836,6 @@ std::vector<NetworkOPsImp::txnMetaLedgerType> NetworkOPsImp::getAccountTxsB (
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
NetworkOPsImp::countAccountTxs (const RippleAddress& account, int32 minLedger, int32 maxLedger)
|
||||
{
|
||||
// can be called with no locks
|
||||
uint32 ret = 0;
|
||||
std::string sql = NetworkOPsImp::transactionsSQL ("COUNT(DISTINCT TransID) AS 'TransactionCount'", account,
|
||||
minLedger, maxLedger, false, 0, -1, true, true, true);
|
||||
|
||||
Database* db = getApp().getTxnDB ()->getDB ();
|
||||
DeprecatedScopedLock sl (getApp().getTxnDB ()->getDBLock ());
|
||||
SQL_FOREACH (db, sql)
|
||||
{
|
||||
ret = db->getInt ("TransactionCount");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
|
||||
NetworkOPsImp::getTxsAccount (const RippleAddress& account, int32 minLedger, int32 maxLedger, bool forward, Json::Value& token, int limit, bool bAdmin)
|
||||
{
|
||||
|
||||
@@ -298,9 +298,6 @@ public:
|
||||
|
||||
virtual std::vector<RippleAddress> getLedgerAffectedAccounts (uint32 ledgerSeq) = 0;
|
||||
|
||||
virtual uint32 countAccountTxs (const RippleAddress& account,
|
||||
int32 minLedger, int32 maxLedger) = 0;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Monitoring: publisher side
|
||||
|
||||
@@ -2113,6 +2113,9 @@ Json::Value RPCHandler::doAccountTxOld (Json::Value params, Resource::Charge& lo
|
||||
if (!raAccount.setAccountID (params["account"].asString ()))
|
||||
return rpcError (rpcACT_MALFORMED);
|
||||
|
||||
if (offset > 3000)
|
||||
return rpcError (rpcATX_DEPRECATED);
|
||||
|
||||
loadType = Resource::feeHighBurdenRPC;
|
||||
|
||||
// DEPRECATED
|
||||
@@ -2159,6 +2162,8 @@ Json::Value RPCHandler::doAccountTxOld (Json::Value params, Resource::Charge& lo
|
||||
uLedgerMin = uLedgerMax = l->getLedgerSeq ();
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
||||
#ifndef BEAST_DEBUG
|
||||
|
||||
try
|
||||
@@ -2179,6 +2184,7 @@ Json::Value RPCHandler::doAccountTxOld (Json::Value params, Resource::Charge& lo
|
||||
for (std::vector<NetworkOPs::txnMetaLedgerType>::const_iterator it = txns.begin (), end = txns.end ();
|
||||
it != end; ++it)
|
||||
{
|
||||
++count;
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
|
||||
uint32 uLedgerIndex = it->get<2> ();
|
||||
@@ -2195,6 +2201,7 @@ Json::Value RPCHandler::doAccountTxOld (Json::Value params, Resource::Charge& lo
|
||||
|
||||
for (std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >::iterator it = txns.begin (), end = txns.end (); it != end; ++it)
|
||||
{
|
||||
++count;
|
||||
Json::Value& jvObj = jvTxns.append (Json::objectValue);
|
||||
|
||||
if (it->first)
|
||||
@@ -2217,8 +2224,10 @@ Json::Value RPCHandler::doAccountTxOld (Json::Value params, Resource::Charge& lo
|
||||
ret["validated"] = bValidated && uValidatedMin <= uLedgerMin && uValidatedMax >= uLedgerMax;
|
||||
ret["offset"] = offset;
|
||||
|
||||
// We no longer return the full count but only the count of returned transactions
|
||||
// Computing this count was two expensive and this API is deprecated anyway
|
||||
if (bCount)
|
||||
ret["count"] = mNetOps->countAccountTxs (raAccount, uLedgerMin, uLedgerMax);
|
||||
ret["count"] = count;
|
||||
|
||||
if (params.isMember ("limit"))
|
||||
ret["limit"] = limit;
|
||||
|
||||
@@ -91,6 +91,7 @@ Json::Value rpcError (int iError, Json::Value jvResult)
|
||||
{ rpcWRONG_SEED, "wrongSeed", "The regular key does not point as the master key." },
|
||||
{ rpcTOO_BUSY, "tooBusy", "The server is too busy to help you now." },
|
||||
{ rpcSLOW_DOWN, "slowDown", "You are placing too much load on the server." },
|
||||
{ rpcATX_DEPRECATED, "deprecated", "Use the new API or specify a ledger range." },
|
||||
};
|
||||
|
||||
int i;
|
||||
|
||||
@@ -94,6 +94,7 @@ enum
|
||||
rpcSRC_AMT_MALFORMED,
|
||||
rpcSRC_CUR_MALFORMED,
|
||||
rpcSRC_ISR_MALFORMED,
|
||||
rpcATX_DEPRECATED,
|
||||
|
||||
// Internal error (should never happen)
|
||||
rpcINTERNAL, // Generic internal error.
|
||||
|
||||
Reference in New Issue
Block a user