mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix account_lines, account_offers and book_offers result (RIPD-682):
The RPC account_lines and account_offers commands respond with the correct ledger info. account_offers, account_lines and book_offers allow admins unlimited size on the limit param. Specifying a negative value on limit clamps to the minimum value allowed. Incorrect types for limit are correctly reported in the result.
This commit is contained in:
committed by
Vinnie Falco
parent
fbffe2367e
commit
63d2cfd6ba
@@ -253,13 +253,9 @@ public:
|
||||
// Book functions
|
||||
//
|
||||
|
||||
void getBookPage (Ledger::pointer lpLedger,
|
||||
Book const&,
|
||||
Account const& uTakerID,
|
||||
const bool bProof,
|
||||
const unsigned int iLimit,
|
||||
Json::Value const& jvMarker,
|
||||
Json::Value& jvResult);
|
||||
void getBookPage (bool bAdmin, Ledger::pointer lpLedger, Book const&,
|
||||
Account const& uTakerID, const bool bProof, const unsigned int iLimit,
|
||||
Json::Value const& jvMarker, Json::Value& jvResult);
|
||||
|
||||
// ledger proposal/close functions
|
||||
void processTrustedProposal (
|
||||
@@ -3090,6 +3086,7 @@ InfoSub::pointer NetworkOPsImp::addRpcSub (
|
||||
//
|
||||
// FIXME : support iLimit.
|
||||
void NetworkOPsImp::getBookPage (
|
||||
bool bAdmin,
|
||||
Ledger::pointer lpLedger,
|
||||
Book const& book,
|
||||
Account const& uTakerID,
|
||||
@@ -3127,14 +3124,13 @@ void NetworkOPsImp::getBookPage (
|
||||
unsigned int uBookEntry;
|
||||
STAmount saDirRate;
|
||||
|
||||
unsigned int iLeft = iLimit;
|
||||
|
||||
if (iLeft == 0 || iLeft > 300)
|
||||
iLeft = 300;
|
||||
|
||||
auto uTransferRate = rippleTransferRate (lesActive, book.out.account);
|
||||
|
||||
while (! bDone && iLeft-- > 0)
|
||||
unsigned int left (iLimit == 0 ? 300 : iLimit);
|
||||
if (! bAdmin && left > 300)
|
||||
left = 300;
|
||||
|
||||
while (!bDone && left-- > 0)
|
||||
{
|
||||
if (bDirectAdvance)
|
||||
{
|
||||
@@ -3308,6 +3304,7 @@ void NetworkOPsImp::getBookPage (
|
||||
|
||||
// FIXME : support iLimit.
|
||||
void NetworkOPsImp::getBookPage (
|
||||
bool bAdmin,
|
||||
Ledger::pointer lpLedger,
|
||||
Book const& book,
|
||||
Account const& uTakerID,
|
||||
@@ -3323,18 +3320,16 @@ void NetworkOPsImp::getBookPage (
|
||||
LedgerEntrySet lesActive (lpLedger, tapNONE, true);
|
||||
OrderBookIterator obIterator (lesActive, book);
|
||||
|
||||
unsigned int iLeft = iLimit;
|
||||
|
||||
if (iLeft == 0 || iLeft > 300)
|
||||
iLeft = 300;
|
||||
|
||||
auto uTransferRate = rippleTransferRate (lesActive, book.out.account);
|
||||
|
||||
const bool bGlobalFreeze = lesActive.isGlobalFrozen (book.out.account) ||
|
||||
lesActive.isGlobalFrozen (book.in.account);
|
||||
|
||||
unsigned int left (iLimit == 0 ? 300 : iLimit);
|
||||
if (! bAdmin && left > 300)
|
||||
left = 300;
|
||||
|
||||
while (iLeft-- > 0 && obIterator.nextOffer ())
|
||||
while (left-- > 0 && obIterator.nextOffer ())
|
||||
{
|
||||
|
||||
SLE::pointer sleOffer = obIterator.getCurrentOffer();
|
||||
|
||||
@@ -188,6 +188,7 @@ public:
|
||||
//
|
||||
|
||||
virtual void getBookPage (
|
||||
bool bAdmin,
|
||||
Ledger::pointer lpLedger,
|
||||
Book const& book,
|
||||
Account const& uTakerID,
|
||||
|
||||
Reference in New Issue
Block a user