mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 23:20:33 +00:00
rename functions
This commit is contained in:
@@ -45,14 +45,14 @@ isZeroId(T const& id)
|
||||
|
||||
// Checks whether an amount is a strictly positive XRP amount.
|
||||
inline bool
|
||||
checkPositiveXRPAmount(xrpl::STAmount const& amount)
|
||||
isPositiveXRPAmount(xrpl::STAmount const& amount)
|
||||
{
|
||||
return xrpl::isXRP(amount) && amount > beast::kZero;
|
||||
}
|
||||
|
||||
// Checks whether an amount (of any asset type) is strictly positive.
|
||||
inline bool
|
||||
checkPositiveAmount(xrpl::STAmount const& amount)
|
||||
isPositiveAmount(xrpl::STAmount const& amount)
|
||||
{
|
||||
return amount > beast::kZero;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ NotTEC
|
||||
escrowCreatePreflightHelper<Issue>(PreflightContext const& ctx)
|
||||
{
|
||||
STAmount const amount = ctx.tx[sfAmount];
|
||||
if (amount.native() || !checkPositiveAmount(amount))
|
||||
if (amount.native() || !isPositiveAmount(amount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (isBadCurrency(amount.get<Issue>().currency))
|
||||
@@ -119,8 +119,7 @@ escrowCreatePreflightHelper<MPTIssue>(PreflightContext const& ctx)
|
||||
return temDISABLED;
|
||||
|
||||
auto const amount = ctx.tx[sfAmount];
|
||||
if (amount.native() || amount.mpt() > MPTAmount{kMaxMpTokenAmount} ||
|
||||
!checkPositiveAmount(amount))
|
||||
if (amount.native() || amount.mpt() > MPTAmount{kMaxMpTokenAmount} || !isPositiveAmount(amount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
return tesSUCCESS;
|
||||
@@ -143,7 +142,7 @@ EscrowCreate::preflight(PreflightContext const& ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!checkPositiveXRPAmount(amount))
|
||||
if (!isPositiveXRPAmount(amount))
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ LoanBrokerCoverDeposit::preflight(PreflightContext const& ctx)
|
||||
return temINVALID;
|
||||
|
||||
auto const dstAmount = ctx.tx[sfAmount];
|
||||
if (!checkPositiveAmount(dstAmount))
|
||||
if (!isPositiveAmount(dstAmount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (!isLegalNet(dstAmount))
|
||||
|
||||
@@ -36,7 +36,7 @@ LoanBrokerCoverWithdraw::preflight(PreflightContext const& ctx)
|
||||
return temINVALID;
|
||||
|
||||
auto const dstAmount = ctx.tx[sfAmount];
|
||||
if (!checkPositiveAmount(dstAmount))
|
||||
if (!isPositiveAmount(dstAmount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (!isLegalNet(dstAmount))
|
||||
|
||||
@@ -53,7 +53,7 @@ LoanPay::preflight(PreflightContext const& ctx)
|
||||
if (isZeroId(ctx.tx[sfLoanID]))
|
||||
return temINVALID;
|
||||
|
||||
if (!checkPositiveAmount(ctx.tx[sfAmount]))
|
||||
if (!isPositiveAmount(ctx.tx[sfAmount]))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
// The loan payment flags are all mutually exclusive. If more than one is
|
||||
|
||||
@@ -185,13 +185,13 @@ Payment::preflight(PreflightContext const& ctx)
|
||||
<< "Payment destination account not specified.";
|
||||
return temDST_NEEDED;
|
||||
}
|
||||
if (hasMax && !checkPositiveAmount(maxSourceAmount))
|
||||
if (hasMax && !isPositiveAmount(maxSourceAmount))
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: bad max amount: "
|
||||
<< maxSourceAmount.getFullText();
|
||||
return temBAD_AMOUNT;
|
||||
}
|
||||
if (!checkPositiveAmount(dstAmount))
|
||||
if (!isPositiveAmount(dstAmount))
|
||||
{
|
||||
JLOG(j.trace()) << "Malformed transaction: bad dst amount: " << dstAmount.getFullText();
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
@@ -48,11 +48,11 @@ PaymentChannelClaim::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
|
||||
auto const bal = ctx.tx[~sfBalance];
|
||||
if (bal && !checkPositiveXRPAmount(*bal))
|
||||
if (bal && !isPositiveXRPAmount(*bal))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
auto const amt = ctx.tx[~sfAmount];
|
||||
if (amt && !checkPositiveXRPAmount(*amt))
|
||||
if (amt && !isPositiveXRPAmount(*amt))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (bal && amt && *bal > *amt)
|
||||
|
||||
@@ -58,7 +58,7 @@ PaymentChannelCreate::makeTxConsequences(PreflightContext const& ctx)
|
||||
NotTEC
|
||||
PaymentChannelCreate::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
if (!checkPositiveXRPAmount(ctx.tx[sfAmount]))
|
||||
if (!isPositiveXRPAmount(ctx.tx[sfAmount]))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (ctx.tx[sfAccount] == ctx.tx[sfDestination])
|
||||
|
||||
@@ -35,7 +35,7 @@ PaymentChannelFund::preflight(PreflightContext const& ctx)
|
||||
if (ctx.rules.enabled(fixCleanup3_2_0) && isZeroId(ctx.tx[sfChannel]))
|
||||
return temMALFORMED;
|
||||
|
||||
if (!checkPositiveXRPAmount(ctx.tx[sfAmount]))
|
||||
if (!isPositiveXRPAmount(ctx.tx[sfAmount]))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
return tesSUCCESS;
|
||||
|
||||
@@ -46,7 +46,7 @@ preflightHelper<Issue>(PreflightContext const& ctx)
|
||||
// The issuer field is used for the token holder instead
|
||||
AccountID const& holder = clawAmount.getIssuer();
|
||||
|
||||
if (issuer == holder || isXRP(clawAmount) || !checkPositiveAmount(clawAmount))
|
||||
if (issuer == holder || isXRP(clawAmount) || !isPositiveAmount(clawAmount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
return tesSUCCESS;
|
||||
@@ -69,7 +69,7 @@ preflightHelper<MPTIssue>(PreflightContext const& ctx)
|
||||
if (ctx.tx[sfAccount] == *mptHolder)
|
||||
return temMALFORMED;
|
||||
|
||||
if (clawAmount.mpt() > MPTAmount{kMaxMpTokenAmount} || !checkPositiveAmount(clawAmount))
|
||||
if (clawAmount.mpt() > MPTAmount{kMaxMpTokenAmount} || !isPositiveAmount(clawAmount))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
return tesSUCCESS;
|
||||
|
||||
@@ -50,7 +50,7 @@ VaultWithdraw::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
if (!checkPositiveAmount(ctx.tx[sfAmount]))
|
||||
if (!isPositiveAmount(ctx.tx[sfAmount]))
|
||||
return temBAD_AMOUNT;
|
||||
|
||||
if (auto const destination = ctx.tx[~sfDestination])
|
||||
|
||||
Reference in New Issue
Block a user