Add deletion_blockers_only param to account_objects RPC command

This commit is contained in:
Joseph Busch
2019-09-19 12:21:59 -05:00
committed by Manoj doshi
parent fccb7e1c70
commit 7e7664c29a
5 changed files with 101 additions and 12 deletions

View File

@@ -82,8 +82,8 @@ accountFromString(
bool
getAccountObjects(ReadView const& ledger, AccountID const& account,
LedgerEntryType const type, uint256 dirIndex, uint256 const& entryIndex,
std::uint32_t const limit, Json::Value& jvResult)
boost::optional<std::vector<LedgerEntryType>> const& typeFilter, uint256 dirIndex,
uint256 const& entryIndex, std::uint32_t const limit, Json::Value& jvResult)
{
auto const rootDirIndex = getOwnerDirIndex (account);
auto found = false;
@@ -117,7 +117,18 @@ getAccountObjects(ReadView const& ledger, AccountID const& account,
for (; iter != entries.end (); ++iter)
{
auto const sleNode = ledger.read(keylet::child(*iter));
if (type == ltINVALID || sleNode->getType () == type)
auto typeMatchesFilter = [] (
std::vector<LedgerEntryType> const& typeFilter,
LedgerEntryType ledgerType)
{
auto it = std::find(typeFilter.begin(), typeFilter.end(),
ledgerType);
return it != typeFilter.end();
};
if (!typeFilter.has_value() ||
typeMatchesFilter(typeFilter.value(), sleNode->getType()))
{
jvObjects.append (sleNode->getJson (JsonOptions::none));

View File

@@ -55,7 +55,7 @@ accountFromString (AccountID& result, std::string const& strIdent,
/** Gathers all objects for an account in a ledger.
@param ledger Ledger to search account objects.
@param account AccountID to find objects for.
@param type Gathers objects of this type. ltINVALID gathers all types.
@param typeFilter Gathers objects of these types. empty gathers all types.
@param dirIndex Begin gathering account objects from this directory.
@param entryIndex Begin gathering objects from this directory node.
@param limit Maximum number of objects to find.
@@ -63,8 +63,8 @@ accountFromString (AccountID& result, std::string const& strIdent,
*/
bool
getAccountObjects (ReadView const& ledger, AccountID const& account,
LedgerEntryType const type, uint256 dirIndex, uint256 const& entryIndex,
std::uint32_t const limit, Json::Value& jvResult);
boost::optional<std::vector<LedgerEntryType>> const& typeFilter, uint256 dirIndex,
uint256 const& entryIndex, std::uint32_t const limit, Json::Value& jvResult);
/** Look up a ledger from a request and fill a Json::Result with either
an error, or data representing a ledger.