From f49dce56b05dd104655b5760260797cd319fa4b0 Mon Sep 17 00:00:00 2001 From: dangell7 Date: Thu, 19 Jan 2023 23:40:39 -0500 Subject: [PATCH] fix paychan marker --- src/ripple/rpc/handlers/AccountChannels.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ripple/rpc/handlers/AccountChannels.cpp b/src/ripple/rpc/handlers/AccountChannels.cpp index 1775487a8..76750a658 100644 --- a/src/ripple/rpc/handlers/AccountChannels.cpp +++ b/src/ripple/rpc/handlers/AccountChannels.cpp @@ -163,7 +163,7 @@ doAccountChannels(RPC::JsonContext& context) accountID, startAfter, startHint, - limit + 1, + limit, [&visitData, &accountID, &count, &limit, &marker, &nextHint]( std::shared_ptr const& sleCur) { if (!sleCur) @@ -172,13 +172,18 @@ doAccountChannels(RPC::JsonContext& context) return false; } + if (sleCur->getType() != ltPAYCHAN) + { + return false; + } + if (++count == limit) { marker = sleCur->key(); nextHint = RPC::getStartHint(sleCur, visitData.accountID); } - if (count <= limit && sleCur->getType() == ltPAYCHAN && + if (count <= limit && (*sleCur)[sfAccount] == accountID && (!visitData.hasDst || visitData.raDstAccount == (*sleCur)[sfDestination])) @@ -195,7 +200,7 @@ doAccountChannels(RPC::JsonContext& context) // Both conditions need to be checked because marker is set on the limit-th // item, but if there is no item on the limit + 1 iteration, then there is // no need to return a marker. - if (count == limit + 1 && marker) + if (count == limit && marker) { result[jss::limit] = limit; result[jss::marker] =