From 72d75c362152bdb1420f08efb73b28f940b29be1 Mon Sep 17 00:00:00 2001 From: natenichols Date: Wed, 15 Dec 2021 14:36:44 -0600 Subject: [PATCH] # This is a combination of 3 commits. # 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 --- src/ripple/rpc/handlers/AccountChannels.cpp | 15 +++++++-------- src/ripple/rpc/handlers/AccountLines.cpp | 13 +++++++------ src/ripple/rpc/handlers/AccountOffers.cpp | 14 +++++++------- src/ripple/rpc/impl/RPCHelpers.cpp | 8 ++++---- src/test/rpc/AccountLinesRPC_test.cpp | 12 ++++++------ src/test/rpc/AccountOffers_test.cpp | 6 +++--- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/ripple/rpc/handlers/AccountChannels.cpp b/src/ripple/rpc/handlers/AccountChannels.cpp index a2b3f7b0990..d02e12bee4c 100644 --- a/src/ripple/rpc/handlers/AccountChannels.cpp +++ b/src/ripple/rpc/handlers/AccountChannels.cpp @@ -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 @@ -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; @@ -166,8 +166,8 @@ doAccountChannels(RPC::JsonContext& context) startAfter, startHint, limit + 1, - [&visitData, &accountID, &ct, &limit, &marker, &nextHint] - (std::shared_ptr const& sleCur) { + [&visitData, &accountID, &ct, &limit, &marker, &nextHint]( + std::shared_ptr const& sleCur) { if (!sleCur) { assert(false); @@ -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])) diff --git a/src/ripple/rpc/handlers/AccountLines.cpp b/src/ripple/rpc/handlers/AccountLines.cpp index 4b4eff78aee..80a4b1dc3fa 100644 --- a/src/ripple/rpc/handlers/AccountLines.cpp +++ b/src/ripple/rpc/handlers/AccountLines.cpp @@ -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); @@ -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; @@ -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 && @@ -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); } diff --git a/src/ripple/rpc/handlers/AccountOffers.cpp b/src/ripple/rpc/handlers/AccountOffers.cpp index 8dde179f147..d0e8e324e07 100644 --- a/src/ripple/rpc/handlers/AccountOffers.cpp +++ b/src/ripple/rpc/handlers/AccountOffers.cpp @@ -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> offers; @@ -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; @@ -143,8 +143,8 @@ doAccountOffers(RPC::JsonContext& context) startAfter, startHint, limit + 1, - [&offers, &ct, &marker, &limit, &nextHint, &accountID] - (std::shared_ptr const& sle) { + [&offers, &ct, &marker, &limit, &nextHint, &accountID]( + std::shared_ptr const& sle) { if (!sle) { assert(false); @@ -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); } diff --git a/src/ripple/rpc/impl/RPCHelpers.cpp b/src/ripple/rpc/impl/RPCHelpers.cpp index e75a55d4d88..ef98cd06c35 100644 --- a/src/ripple/rpc/impl/RPCHelpers.cpp +++ b/src/ripple/rpc/impl/RPCHelpers.cpp @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -100,7 +100,7 @@ getStartHint(std::shared_ptr const& sle, AccountID const& accountID) else if (sle->getFieldAmount(sfHighLimit).getIssuer() == accountID) return sle->getFieldU64(sfHighNode); } - + return sle->getFieldU64(sfOwnerNode); } @@ -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)) { diff --git a/src/test/rpc/AccountLinesRPC_test.cpp b/src/test/rpc/AccountLinesRPC_test.cpp index 6834e9456c7..2e25b90a5a6 100644 --- a/src/test/rpc/AccountLinesRPC_test.cpp +++ b/src/test/rpc/AccountLinesRPC_test.cpp @@ -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(); @@ -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. @@ -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]); } @@ -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(); diff --git a/src/test/rpc/AccountOffers_test.cpp b/src/test/rpc/AccountOffers_test.cpp index 1b80ee0000c..f4ad0a72595 100644 --- a/src/test/rpc/AccountOffers_test.cpp +++ b/src/test/rpc/AccountOffers_test.cpp @@ -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)); } @@ -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", @@ -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)); } } }