mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 15:20:54 +00:00
chore: Apply clang-format width 100 (#6387)
This commit is contained in:
@@ -53,7 +53,12 @@ trustFlag(TrustFlag f, bool useHigh)
|
||||
}
|
||||
|
||||
bool
|
||||
getTrustFlag(jtx::Env const& env, jtx::Account const& src, jtx::Account const& dst, Currency const& cur, TrustFlag flag)
|
||||
getTrustFlag(
|
||||
jtx::Env const& env,
|
||||
jtx::Account const& src,
|
||||
jtx::Account const& dst,
|
||||
Currency const& cur,
|
||||
TrustFlag flag)
|
||||
{
|
||||
if (auto sle = env.le(keylet::line(src, dst, cur)))
|
||||
{
|
||||
@@ -127,7 +132,10 @@ STPathElement
|
||||
ipe(Issue const& iss)
|
||||
{
|
||||
return STPathElement(
|
||||
STPathElement::typeCurrency | STPathElement::typeIssuer, xrpAccount(), iss.currency, iss.account);
|
||||
STPathElement::typeCurrency | STPathElement::typeIssuer,
|
||||
xrpAccount(),
|
||||
iss.currency,
|
||||
iss.account);
|
||||
};
|
||||
|
||||
// Issuer path element
|
||||
@@ -201,8 +209,10 @@ public:
|
||||
{
|
||||
return (allowCompound_ || !(has(SB::acc) && hasAny({SB::cur, SB::iss}))) &&
|
||||
(!hasAny({SB::prevAcc, SB::prevCur, SB::prevIss}) || prev_) &&
|
||||
(!hasAny({SB::rootAcc, SB::sameAccIss, SB::existingAcc, SB::prevAcc}) || has(SB::acc)) &&
|
||||
(!hasAny({SB::rootIss, SB::sameAccIss, SB::existingIss, SB::prevIss}) || has(SB::iss)) &&
|
||||
(!hasAny({SB::rootAcc, SB::sameAccIss, SB::existingAcc, SB::prevAcc}) ||
|
||||
has(SB::acc)) &&
|
||||
(!hasAny({SB::rootIss, SB::sameAccIss, SB::existingIss, SB::prevIss}) ||
|
||||
has(SB::iss)) &&
|
||||
(!hasAny({SB::xrp, SB::existingCur, SB::prevCur}) || has(SB::cur)) &&
|
||||
// These will be duplicates
|
||||
(count({SB::xrp, SB::existingCur, SB::prevCur}) <= 1) &&
|
||||
@@ -535,14 +545,16 @@ struct ExistingElementPool
|
||||
{
|
||||
StateGuard og{*this};
|
||||
outerResult = prefix;
|
||||
outer.emplace_into(outerResult, accF, issF, currencyF, existingAcc, existingCur, existingIss);
|
||||
outer.emplace_into(
|
||||
outerResult, accF, issF, currencyF, existingAcc, existingCur, existingIss);
|
||||
STPathElement const* prevInner = &outerResult.back();
|
||||
ElementComboIter inner(prevInner);
|
||||
while (inner.next())
|
||||
{
|
||||
StateGuard ig{*this};
|
||||
result = outerResult;
|
||||
inner.emplace_into(result, accF, issF, currencyF, existingAcc, existingCur, existingIss);
|
||||
inner.emplace_into(
|
||||
result, accF, issF, currencyF, existingAcc, existingCur, existingIss);
|
||||
result.insert(result.end(), suffix.begin(), suffix.end());
|
||||
f(sendMax, deliver, result);
|
||||
}
|
||||
@@ -659,7 +671,8 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
env(pay(gw, carol, USD(100)));
|
||||
|
||||
// Insert implied account
|
||||
test(env, USD, std::nullopt, STPath(), tesSUCCESS, D{alice, gw, usdC}, D{gw, bob, usdC});
|
||||
test(
|
||||
env, USD, std::nullopt, STPath(), tesSUCCESS, D{alice, gw, usdC}, D{gw, bob, usdC});
|
||||
env.trust(EUR(1000), alice, bob);
|
||||
|
||||
// Insert implied offer
|
||||
@@ -712,7 +725,8 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
env,
|
||||
xrpIssue(),
|
||||
USD.issue(),
|
||||
STPath({STPathElement{STPathElement::typeCurrency, xrpAccount(), xrpCurrency(), xrpAccount()}}),
|
||||
STPath({STPathElement{
|
||||
STPathElement::typeCurrency, xrpAccount(), xrpCurrency(), xrpAccount()}}),
|
||||
tesSUCCESS,
|
||||
D{alice, gw, usdC},
|
||||
B{USD, XRP, std::nullopt},
|
||||
@@ -936,7 +950,8 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
std::nullopt,
|
||||
env.app().logs().journal("Flow"));
|
||||
BEAST_EXPECT(ter == tesSUCCESS);
|
||||
BEAST_EXPECT(equal(strand, D{alice, gw, usdC}, B{USD.issue(), xrpIssue(), std::nullopt}, XRPS{bob}));
|
||||
BEAST_EXPECT(equal(
|
||||
strand, D{alice, gw, usdC}, B{USD.issue(), xrpIssue(), std::nullopt}, XRPS{bob}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,7 +1011,10 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
env(offer(bob, USD(100), XRP(100)), txflags(tfPassive));
|
||||
|
||||
// payment path: XRP -> XRP/USD -> USD/XRP
|
||||
env(pay(alice, carol, XRP(100)), path(~USD, ~XRP), txflags(tfNoRippleDirect), ter(temBAD_SEND_XRP_PATHS));
|
||||
env(pay(alice, carol, XRP(100)),
|
||||
path(~USD, ~XRP),
|
||||
txflags(tfNoRippleDirect),
|
||||
ter(temBAD_SEND_XRP_PATHS));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1104,22 +1122,54 @@ struct PayStrand_test : public beast::unit_test::suite
|
||||
PaymentSandbox sb{env.current().get(), tapNONE};
|
||||
{
|
||||
auto const r = ::xrpl::path::RippleCalc::rippleCalculate(
|
||||
sb, sendMax, deliver, dstAcc, noAccount(), pathSet, std::nullopt, env.app().logs(), &inputs);
|
||||
sb,
|
||||
sendMax,
|
||||
deliver,
|
||||
dstAcc,
|
||||
noAccount(),
|
||||
pathSet,
|
||||
std::nullopt,
|
||||
env.app().logs(),
|
||||
&inputs);
|
||||
BEAST_EXPECT(r.result() == temBAD_PATH);
|
||||
}
|
||||
{
|
||||
auto const r = ::xrpl::path::RippleCalc::rippleCalculate(
|
||||
sb, sendMax, deliver, noAccount(), srcAcc, pathSet, std::nullopt, env.app().logs(), &inputs);
|
||||
sb,
|
||||
sendMax,
|
||||
deliver,
|
||||
noAccount(),
|
||||
srcAcc,
|
||||
pathSet,
|
||||
std::nullopt,
|
||||
env.app().logs(),
|
||||
&inputs);
|
||||
BEAST_EXPECT(r.result() == temBAD_PATH);
|
||||
}
|
||||
{
|
||||
auto const r = ::xrpl::path::RippleCalc::rippleCalculate(
|
||||
sb, noAccountAmount, deliver, dstAcc, srcAcc, pathSet, std::nullopt, env.app().logs(), &inputs);
|
||||
sb,
|
||||
noAccountAmount,
|
||||
deliver,
|
||||
dstAcc,
|
||||
srcAcc,
|
||||
pathSet,
|
||||
std::nullopt,
|
||||
env.app().logs(),
|
||||
&inputs);
|
||||
BEAST_EXPECT(r.result() == temBAD_PATH);
|
||||
}
|
||||
{
|
||||
auto const r = ::xrpl::path::RippleCalc::rippleCalculate(
|
||||
sb, sendMax, noAccountAmount, dstAcc, srcAcc, pathSet, std::nullopt, env.app().logs(), &inputs);
|
||||
sb,
|
||||
sendMax,
|
||||
noAccountAmount,
|
||||
dstAcc,
|
||||
srcAcc,
|
||||
pathSet,
|
||||
std::nullopt,
|
||||
env.app().logs(),
|
||||
&inputs);
|
||||
BEAST_EXPECT(r.result() == temBAD_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user