return no offers when an owner directory is not found (#176)

This commit is contained in:
Nathan Nichols
2022-06-15 16:19:08 -05:00
committed by GitHub
parent 3d3b8e91b6
commit fa8405df83
6 changed files with 29 additions and 4 deletions

View File

@@ -764,7 +764,7 @@ traverseOwnedNodes(
backend.fetchLedgerObject(currentIndex.key, sequence, yield);
if (!ownerDir)
return Status(ripple::rpcACT_NOT_FOUND);
break;
ripple::SerialIter it{ownerDir->data(), ownerDir->size()};
ripple::SLE sle{it, currentIndex.key};

View File

@@ -58,6 +58,12 @@ doAccountChannels(Context const& context)
if (auto const status = getAccount(request, accountID); status)
return status;
auto rawAcct = context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield);
if (!rawAcct)
return Status{Error::rpcACT_NOT_FOUND, "accountNotFound"};
ripple::AccountID destAccount;
if (auto const status =
getAccount(request, destAccount, JS(destination_account));

View File

@@ -28,6 +28,12 @@ doAccountCurrencies(Context const& context)
if (auto const status = getAccount(request, accountID); status)
return status;
auto rawAcct = context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield);
if (!rawAcct)
return Status{Error::rpcACT_NOT_FOUND, "accountNotFound"};
std::set<std::string> send, receive;
auto const addToResponse = [&](ripple::SLE const& sle) {
if (sle.getType() == ripple::ltRIPPLE_STATE)

View File

@@ -103,6 +103,12 @@ doAccountLines(Context const& context)
if (auto const status = getAccount(request, accountID); status)
return status;
auto rawAcct = context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield);
if (!rawAcct)
return Status{Error::rpcACT_NOT_FOUND, "accountNotFound"};
ripple::AccountID peerAccount;
if (auto const status = getAccount(request, peerAccount, JS(peer)); status)
return status;

View File

@@ -47,9 +47,10 @@ doAccountNFTs(Context const& context)
if (!accountID)
return Status{Error::rpcINVALID_PARAMS, "malformedAccount"};
// TODO: just check for existence without pulling
if (!context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield))
auto rawAcct = context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield);
if (!rawAcct)
return Status{Error::rpcACT_NOT_FOUND, "accountNotFound"};
// limit controls the number of pages being returned. each page could have

View File

@@ -80,6 +80,12 @@ doAccountOffers(Context const& context)
if (auto const status = getAccount(request, accountID); status)
return status;
auto rawAcct = context.backend->fetchLedgerObject(
ripple::keylet::account(accountID).key, lgrInfo.seq, context.yield);
if (!rawAcct)
return Status{Error::rpcACT_NOT_FOUND, "accountNotFound"};
std::uint32_t limit = 200;
if (auto const status = getLimit(request, limit); status)
return status;