fix paychan marker

This commit is contained in:
dangell7
2023-01-19 23:40:39 -05:00
committed by Richard Holland
parent ccb3f36245
commit f49dce56b0

View File

@@ -163,7 +163,7 @@ doAccountChannels(RPC::JsonContext& context)
accountID,
startAfter,
startHint,
limit + 1,
limit,
[&visitData, &accountID, &count, &limit, &marker, &nextHint](
std::shared_ptr<SLE const> 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] =