mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
refactor EscrowCancel
This commit is contained in:
@@ -130,6 +130,14 @@ public:
|
||||
[[nodiscard]] bool
|
||||
requiresAuth() const override;
|
||||
|
||||
[[nodiscard]] TER
|
||||
checkExists() const override
|
||||
{
|
||||
if (!exists())
|
||||
return tecOBJECT_NOT_FOUND;
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
hasHolder(AccountID const& holder) const override
|
||||
{
|
||||
|
||||
@@ -132,6 +132,14 @@ public:
|
||||
[[nodiscard]] bool
|
||||
requiresAuth() const override;
|
||||
|
||||
[[nodiscard]] TER
|
||||
checkExists() const override
|
||||
{
|
||||
if (!exists())
|
||||
return tecNO_ISSUER;
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
hasHolder(AccountID const& holder) const override
|
||||
{
|
||||
|
||||
@@ -160,6 +160,9 @@ public:
|
||||
[[nodiscard]] virtual bool
|
||||
requiresAuth() const = 0;
|
||||
|
||||
[[nodiscard]] virtual TER
|
||||
checkExists() const = 0;
|
||||
|
||||
[[nodiscard]] virtual bool
|
||||
hasHolder(AccountID const& holder) const = 0;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FIX (TypeSafetyRefactor, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (PermissionedDomainInvariant, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::no, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -82,13 +82,31 @@ EscrowCancel::preclaim(PreclaimContext const& ctx)
|
||||
|
||||
if (!isXRP(amount))
|
||||
{
|
||||
if (auto const ret = std::visit(
|
||||
if (ctx.view.rules().enabled(fixTypeSafetyRefactor))
|
||||
{
|
||||
AccountID issuer = amount.getIssuer();
|
||||
// If the issuer is the same as the account, return tecINTERNAL
|
||||
if (issuer == account)
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
|
||||
auto const token = makeTokenBase(ctx.view, amount.issue());
|
||||
if (auto const ter = token->checkExists(); !isTesSuccess(ter))
|
||||
return ter;
|
||||
|
||||
if (auto const ter = token->requireAuth(account, AuthType::WeakAuth);
|
||||
!isTesSuccess(ter))
|
||||
return ter;
|
||||
}
|
||||
else if (
|
||||
auto const ret = std::visit(
|
||||
[&]<typename T>(T const&) {
|
||||
return escrowCancelPreclaimHelper<T>(ctx, account, amount);
|
||||
},
|
||||
amount.asset().value());
|
||||
!isTesSuccess(ret))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tesSUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user