mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Review feedback from @gregtatcam
- Rename "accountCanSpend" to "accountSpendabled". - Change some getIssuer() local vars to use references.
This commit is contained in:
@@ -352,7 +352,7 @@ accountHolds(
|
||||
//
|
||||
// <-- saAmount: amount of currency held by account. May be negative.
|
||||
[[nodiscard]] STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Currency const& currency,
|
||||
@@ -361,7 +361,7 @@ accountCanSend(
|
||||
beast::Journal j);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Issue const& issue,
|
||||
@@ -369,7 +369,7 @@ accountCanSend(
|
||||
beast::Journal j);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
MPTIssue const& mptIssue,
|
||||
@@ -378,7 +378,7 @@ accountCanSend(
|
||||
beast::Journal j);
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Asset const& asset,
|
||||
|
||||
@@ -564,7 +564,7 @@ accountHolds(
|
||||
}
|
||||
|
||||
STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Currency const& currency,
|
||||
@@ -589,19 +589,19 @@ accountCanSend(
|
||||
}
|
||||
|
||||
STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Issue const& issue,
|
||||
FreezeHandling zeroIfFrozen,
|
||||
beast::Journal j)
|
||||
{
|
||||
return accountCanSend(
|
||||
return accountSpendable(
|
||||
view, account, issue.currency, issue.account, zeroIfFrozen, j);
|
||||
}
|
||||
|
||||
STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
MPTIssue const& mptIssue,
|
||||
@@ -631,7 +631,7 @@ accountCanSend(
|
||||
}
|
||||
|
||||
[[nodiscard]] STAmount
|
||||
accountCanSend(
|
||||
accountSpendable(
|
||||
ReadView const& view,
|
||||
AccountID const& account,
|
||||
Asset const& asset,
|
||||
@@ -645,9 +645,9 @@ accountCanSend(
|
||||
std::remove_cvref_t<decltype(value)>,
|
||||
Issue>)
|
||||
{
|
||||
return accountCanSend(view, account, value, zeroIfFrozen, j);
|
||||
return accountSpendable(view, account, value, zeroIfFrozen, j);
|
||||
}
|
||||
return accountCanSend(
|
||||
return accountSpendable(
|
||||
view, account, value, zeroIfFrozen, zeroIfUnauthorized, j);
|
||||
},
|
||||
asset.value());
|
||||
@@ -2064,7 +2064,7 @@ rippleSendIOU(
|
||||
beast::Journal j,
|
||||
WaiveTransferFee waiveFee)
|
||||
{
|
||||
auto const issuer = saAmount.getIssuer();
|
||||
auto const& issuer = saAmount.getIssuer();
|
||||
|
||||
XRPL_ASSERT(
|
||||
!isXRP(uSenderID) && !isXRP(uReceiverID),
|
||||
@@ -2119,7 +2119,7 @@ rippleSendMultiIOU(
|
||||
beast::Journal j,
|
||||
WaiveTransferFee waiveFee)
|
||||
{
|
||||
auto const issuer = issue.getIssuer();
|
||||
auto const& issuer = issue.getIssuer();
|
||||
|
||||
XRPL_ASSERT(
|
||||
!isXRP(senderID), "ripple::rippleSendMultiIOU : sender is not XRP");
|
||||
@@ -2459,7 +2459,7 @@ rippleCreditMPT(
|
||||
{
|
||||
// Do not check MPT authorization here - it must have been checked earlier
|
||||
auto const mptID = keylet::mptIssuance(saAmount.get<MPTIssue>().getMptID());
|
||||
auto const issuer = saAmount.getIssuer();
|
||||
auto const& issuer = saAmount.getIssuer();
|
||||
auto sleIssuance = view.peek(mptID);
|
||||
if (!sleIssuance)
|
||||
return tecOBJECT_NOT_FOUND;
|
||||
@@ -2526,7 +2526,7 @@ rippleSendMPT(
|
||||
"ripple::rippleSendMPT : sender is not receiver");
|
||||
|
||||
// Safe to get MPT since rippleSendMPT is only called by accountSendMPT
|
||||
auto const issuer = saAmount.getIssuer();
|
||||
auto const& issuer = saAmount.getIssuer();
|
||||
|
||||
auto const sle =
|
||||
view.read(keylet::mptIssuance(saAmount.get<MPTIssue>().getMptID()));
|
||||
@@ -2589,7 +2589,7 @@ rippleSendMultiMPT(
|
||||
{
|
||||
// Safe to get MPT since rippleSendMultiMPT is only called by
|
||||
// accountSendMultiMPT
|
||||
auto const issuer = mptIssue.getIssuer();
|
||||
auto const& issuer = mptIssue.getIssuer();
|
||||
|
||||
auto const sle = view.read(keylet::mptIssuance(mptIssue.getMptID()));
|
||||
if (!sle)
|
||||
@@ -3287,7 +3287,7 @@ canTransfer(
|
||||
if (issue.native())
|
||||
return tesSUCCESS;
|
||||
|
||||
auto const issuerId = issue.getIssuer();
|
||||
auto const& issuerId = issue.getIssuer();
|
||||
if (issuerId == from || issuerId == to)
|
||||
return tesSUCCESS;
|
||||
auto const sleIssuer = view.read(keylet::account(issuerId));
|
||||
|
||||
@@ -212,7 +212,7 @@ LoanPay::preclaim(PreclaimContext const& ctx)
|
||||
// Do not support "partial payments" - if the transaction says to pay X,
|
||||
// then the account must have X available, even if the loan payment takes
|
||||
// less.
|
||||
if (auto const balance = accountCanSend(
|
||||
if (auto const balance = accountSpendable(
|
||||
ctx.view,
|
||||
account,
|
||||
asset,
|
||||
@@ -470,11 +470,11 @@ LoanPay::doApply()
|
||||
}
|
||||
|
||||
#if !NDEBUG
|
||||
auto const accountBalanceBefore = accountCanSend(
|
||||
auto const accountBalanceBefore = accountSpendable(
|
||||
view, account_, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_);
|
||||
auto const vaultBalanceBefore = account_ == vaultPseudoAccount
|
||||
? STAmount{asset, 0}
|
||||
: accountCanSend(
|
||||
: accountSpendable(
|
||||
view,
|
||||
vaultPseudoAccount,
|
||||
asset,
|
||||
@@ -483,7 +483,7 @@ LoanPay::doApply()
|
||||
j_);
|
||||
auto const brokerBalanceBefore = account_ == brokerPayee
|
||||
? STAmount{asset, 0}
|
||||
: accountCanSend(
|
||||
: accountSpendable(
|
||||
view, brokerPayee, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_);
|
||||
#endif
|
||||
|
||||
@@ -539,11 +539,11 @@ LoanPay::doApply()
|
||||
"vault pseudo balance agrees after");
|
||||
|
||||
#if !NDEBUG
|
||||
auto const accountBalanceAfter = accountCanSend(
|
||||
auto const accountBalanceAfter = accountSpendable(
|
||||
view, account_, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_);
|
||||
auto const vaultBalanceAfter = account_ == vaultPseudoAccount
|
||||
? STAmount{asset, 0}
|
||||
: accountCanSend(
|
||||
: accountSpendable(
|
||||
view,
|
||||
vaultPseudoAccount,
|
||||
asset,
|
||||
@@ -552,7 +552,7 @@ LoanPay::doApply()
|
||||
j_);
|
||||
auto const brokerBalanceAfter = account_ == brokerPayee
|
||||
? STAmount{asset, 0}
|
||||
: accountCanSend(
|
||||
: accountSpendable(
|
||||
view, brokerPayee, asset, fhIGNORE_FREEZE, ahIGNORE_AUTH, j_);
|
||||
|
||||
XRPL_ASSERT_PARTS(
|
||||
|
||||
Reference in New Issue
Block a user