mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Review feedbak from @tequdev, plus helpers
- Fix LoanSet.calculateBaseFee with multisign.
- Cleanups.
- Add View helper functions for Loan and Vault transactions
- preflightDestinationAndTag
- checkDestinationAndTag
- canSendToAccount
- Used the helpers in appropriate Loan and Vault transactions.
- They could also be used in older transactions, I'll save that for
later.
This commit is contained in:
@@ -694,7 +694,7 @@ isPseudoAccount(std::shared_ptr<SLE const> sleAcct);
|
||||
getPseudoAccountFields();
|
||||
|
||||
[[nodiscard]] inline bool
|
||||
isPseudoAccount(ReadView const& view, AccountID accountId)
|
||||
isPseudoAccount(ReadView const& view, AccountID const& accountId)
|
||||
{
|
||||
return isPseudoAccount(view.read(keylet::account(accountId)));
|
||||
}
|
||||
@@ -702,6 +702,51 @@ isPseudoAccount(ReadView const& view, AccountID accountId)
|
||||
[[nodiscard]] TER
|
||||
canAddHolding(ReadView const& view, Asset const& asset);
|
||||
|
||||
/** Checks that the destination and destination tag are valid.
|
||||
|
||||
- If destination is set, it must not be zero.
|
||||
- If not set, there must not be a destination tag.
|
||||
*/
|
||||
[[nodiscard]] NotTEC
|
||||
preflightDestinationAndTag(
|
||||
std::optional<AccountID> const& destination,
|
||||
bool hasDestinationTag);
|
||||
|
||||
/** Validates that the destination SLE and tag are valid
|
||||
|
||||
- Checks that the SLE is not null.
|
||||
- If the SLE requires a destination tag, checks that there is a tag.
|
||||
*/
|
||||
[[nodiscard]] TER
|
||||
checkDestinationAndTag(SLE::const_ref toSle, bool hasDestinationTag);
|
||||
|
||||
/** Checks that from can sent to to (with an SLE)
|
||||
|
||||
- Does the checkDestinationAndTag checks, plus:
|
||||
- if the destination requires deposit auth, checks that the from account has
|
||||
that auth.
|
||||
*/
|
||||
[[nodiscard]] TER
|
||||
canSendToAccount(
|
||||
AccountID const& from,
|
||||
ReadView const& view,
|
||||
SLE::const_ref toSle,
|
||||
bool hasDestinationTag);
|
||||
|
||||
/** Checks that from can sent to to (with an AccountID)
|
||||
|
||||
- Loads the SLE for "to"
|
||||
- Checks whether the account is trying to send to itself.
|
||||
Succeeds if the SLE exists, fails if not.
|
||||
- Then does the checkDestinationAndTag check with an SLE.
|
||||
*/
|
||||
[[nodiscard]] TER
|
||||
canSendToAccount(
|
||||
AccountID const& from,
|
||||
ReadView const& view,
|
||||
AccountID const& to,
|
||||
bool hasDestinationTag);
|
||||
|
||||
/// Any transactors that call addEmptyHolding() in doApply must call
|
||||
/// canAddHolding() in preflight with the same View and Asset
|
||||
[[nodiscard]] TER
|
||||
|
||||
Reference in New Issue
Block a user