Skip to content

Commit

Permalink
# This is a combination of 3 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

[FOLD] rebase

# This is the commit message #2:

[FOLD] Formatting

# This is the commit message #3:

[FOLD] format test
  • Loading branch information
natenichols committed Dec 15, 2021
1 parent 8dd6596 commit 72d75c3
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
15 changes: 7 additions & 8 deletions src/ripple/rpc/handlers/AccountChannels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ doAccountChannels(RPC::JsonContext& context)
unsigned int limit;
if (auto err = readLimitField(limit, RPC::Tuning::accountChannels, context))
return *err;

if (limit == 0u)
return rpcError(rpcINVALID_PARAMS);
return rpcError(rpcINVALID_PARAMS);

Json::Value jsonChannels{Json::arrayValue};
struct VisitData
Expand All @@ -121,8 +121,8 @@ doAccountChannels(RPC::JsonContext& context)
{
if (!params[jss::marker].isString())
return RPC::expected_field_error(jss::marker, "string");
// Marker is composed of a comma separated index and start hint. The

// Marker is composed of a comma separated index and start hint. The
// former will be read as hex, and the latter using boost lexical cast.
std::stringstream ss(params[jss::marker].asString());
std::string s;
Expand Down Expand Up @@ -166,8 +166,8 @@ doAccountChannels(RPC::JsonContext& context)
startAfter,
startHint,
limit + 1,
[&visitData, &accountID, &ct, &limit, &marker, &nextHint]
(std::shared_ptr<SLE const> const& sleCur) {
[&visitData, &accountID, &ct, &limit, &marker, &nextHint](
std::shared_ptr<SLE const> const& sleCur) {
if (!sleCur)
{
assert(false);
Expand All @@ -180,8 +180,7 @@ doAccountChannels(RPC::JsonContext& context)
nextHint = RPC::getStartHint(sleCur, visitData.accountID);
}

if (ct <= limit &&
sleCur->getType() == ltPAYCHAN &&
if (ct <= limit && sleCur->getType() == ltPAYCHAN &&
(*sleCur)[sfAccount] == accountID &&
(!visitData.hasDst ||
visitData.raDstAccount == (*sleCur)[sfDestination]))
Expand Down
13 changes: 7 additions & 6 deletions src/ripple/rpc/handlers/AccountLines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ doAccountLines(RPC::JsonContext& context)
unsigned int limit;
if (auto err = readLimitField(limit, RPC::Tuning::accountLines, context))
return *err;

if (limit == 0)
return rpcError(rpcINVALID_PARAMS);

Expand All @@ -148,8 +148,8 @@ doAccountLines(RPC::JsonContext& context)
{
if (!params[jss::marker].isString())
return RPC::expected_field_error(jss::marker, "string");
// Marker is composed of a comma separated index and start hint. The

// Marker is composed of a comma separated index and start hint. The
// former will be read as hex, and the latter using boost lexical cast.
std::stringstream ss(params[jss::marker].asString());
std::string s;
Expand Down Expand Up @@ -216,9 +216,10 @@ doAccountLines(RPC::JsonContext& context)
if (++ct == limit)
{
marker = sleCur->key();
nextHint = RPC::getStartHint(sleCur, visitData.accountID);
nextHint =
RPC::getStartHint(sleCur, visitData.accountID);
}

auto const line =
RippleState::makeItem(visitData.accountID, sleCur);
if (ct <= limit && line != nullptr &&
Expand All @@ -239,7 +240,7 @@ doAccountLines(RPC::JsonContext& context)
if (ct == limit + 1 && marker)
{
result[jss::limit] = limit;
result[jss::marker] =
result[jss::marker] =
to_string(*marker) + "," + std::to_string(nextHint);
}

Expand Down
14 changes: 7 additions & 7 deletions src/ripple/rpc/handlers/AccountOffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ doAccountOffers(RPC::JsonContext& context)
unsigned int limit;
if (auto err = readLimitField(limit, RPC::Tuning::accountOffers, context))
return *err;

if (limit == 0)
return rpcError(rpcINVALID_PARAMS);
return rpcError(rpcINVALID_PARAMS);

Json::Value& jsonOffers(result[jss::offers] = Json::arrayValue);
std::vector<std::shared_ptr<SLE const>> offers;
Expand All @@ -98,8 +98,8 @@ doAccountOffers(RPC::JsonContext& context)
{
if (!params[jss::marker].isString())
return RPC::expected_field_error(jss::marker, "string");
// Marker is composed of a comma separated index and start hint. The

// Marker is composed of a comma separated index and start hint. The
// former will be read as hex, and the latter using boost lexical cast.
std::stringstream ss(params[jss::marker].asString());
std::string s;
Expand Down Expand Up @@ -143,8 +143,8 @@ doAccountOffers(RPC::JsonContext& context)
startAfter,
startHint,
limit + 1,
[&offers, &ct, &marker, &limit, &nextHint, &accountID]
(std::shared_ptr<SLE const> const& sle) {
[&offers, &ct, &marker, &limit, &nextHint, &accountID](
std::shared_ptr<SLE const> const& sle) {
if (!sle)
{
assert(false);
Expand All @@ -171,7 +171,7 @@ doAccountOffers(RPC::JsonContext& context)
if (ct == limit + 1 && marker)
{
result[jss::limit] = limit;
result[jss::marker] =
result[jss::marker] =
to_string(*marker) + "," + std::to_string(nextHint);
}

Expand Down
8 changes: 4 additions & 4 deletions src/ripple/rpc/impl/RPCHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/app/ledger/OpenLedger.h>
#include <ripple/app/misc/Transaction.h>
#include <ripple/app/rdb/RelationalDBInterface.h>
#include <ripple/app/paths/RippleState.h>
#include <ripple/app/rdb/RelationalDBInterface.h>
#include <ripple/ledger/View.h>
#include <ripple/net/RPCErr.h>
#include <ripple/protocol/AccountID.h>
Expand Down Expand Up @@ -100,7 +100,7 @@ getStartHint(std::shared_ptr<SLE const> const& sle, AccountID const& accountID)
else if (sle->getFieldAmount(sfHighLimit).getIssuer() == accountID)
return sle->getFieldU64(sfHighNode);
}

return sle->getFieldU64(sfOwnerNode);
}

Expand All @@ -112,8 +112,8 @@ isOwnedByAccount(
{
if (sle->getType() == ltRIPPLE_STATE)
{
return (sle->getFieldAmount(sfLowLimit).getIssuer() == accountID)
|| (sle->getFieldAmount(sfHighLimit).getIssuer() == accountID);
return (sle->getFieldAmount(sfLowLimit).getIssuer() == accountID) ||
(sle->getFieldAmount(sfHighLimit).getIssuer() == accountID);
}
else if (sle->isFieldPresent(sfAccount))
{
Expand Down
12 changes: 6 additions & 6 deletions src/test/rpc/AccountLinesRPC_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ class AccountLinesRPC_test : public beast::unit_test::suite
env.close();

auto const USD = gw1["USD"];
auto const AUD = gw1["AUD"];
auto const AUD = gw1["AUD"];
auto const EUR = gw2["EUR"];
env(trust(alice, USD(200)));
env(trust(alice, AUD(200)));
env(trust(alice, AUD(200)));
env(trust(becky, EUR(200)));
env(trust(cheri, EUR(200)));
env.close();
Expand All @@ -418,7 +418,7 @@ class AccountLinesRPC_test : public beast::unit_test::suite
R"(", )"
R"("limit": 2})");
BEAST_EXPECT(
linesBeg[jss::result][jss::lines][0u][jss::currency] == "USD");
linesBeg[jss::result][jss::lines][0u][jss::currency] == "USD");
BEAST_EXPECT(linesBeg[jss::result].isMember(jss::marker));

// alice pays 100 EUR to cheri.
Expand All @@ -435,7 +435,7 @@ class AccountLinesRPC_test : public beast::unit_test::suite
R"("marker": ")" +
linesBeg[jss::result][jss::marker].asString() + R"("})");
BEAST_EXPECT(
linesEnd[jss::result][jss::error_message] ==
linesEnd[jss::result][jss::error_message] ==
RPC::make_error(rpcINVALID_PARAMS)[jss::error_message]);
}

Expand Down Expand Up @@ -1071,9 +1071,9 @@ class AccountLinesRPC_test : public beast::unit_test::suite

auto const USD = gw1["USD"];
auto const AUD = gw1["AUD"];
auto const EUR = gw2["EUR"];
auto const EUR = gw2["EUR"];
env(trust(alice, USD(200)));
env(trust(alice, AUD(200)));
env(trust(alice, AUD(200)));
env(trust(becky, EUR(200)));
env(trust(cheri, EUR(200)));
env.close();
Expand Down
6 changes: 3 additions & 3 deletions src/test/rpc/AccountOffers_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class AccountOffers_test : public beast::unit_test::suite
"json", "account_offers", jvParams.toStyledString())[jss::result];
auto const& jro_l = jrr_l[jss::offers];
BEAST_EXPECT(checkMarker(jrr_l));
// 9u is the expected size, since one account object is a trustline
// 9u is the expected size, since one account object is a trustline
BEAST_EXPECT(checkArraySize(jro_l, 9u));
}

Expand Down Expand Up @@ -174,7 +174,7 @@ class AccountOffers_test : public beast::unit_test::suite

// last item...with previous marker passed
jvParams[jss::marker] = jrr_l_2[jss::marker];
jvParams[jss::limit] = 10u;
jvParams[jss::limit] = 10u;
auto const jrr_l_3 = env.rpc(
"json",
"account_offers",
Expand Down Expand Up @@ -214,7 +214,7 @@ class AccountOffers_test : public beast::unit_test::suite
{
// Call should enforce min limit of 10
BEAST_EXPECT(checkArraySize(jro, 3u));
BEAST_EXPECT(!jrr.isMember(jss::marker));
BEAST_EXPECT(!jrr.isMember(jss::marker));
}
}
}
Expand Down

0 comments on commit 72d75c3

Please sign in to comment.