Skip to content

Commit

Permalink
modify according to comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyiqian1 committed Nov 22, 2024
1 parent 3356b25 commit 0083a15
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/xrpld/app/tx/detail/AMMClawback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ AMMClawback::preflight(PreflightContext const& ctx)
if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
return ret; // LCOV_EXCL_LINE

auto const flags = ctx.tx.getFlags();
if (flags & tfAMMClawbackMask)
return temINVALID_FLAG;

AccountID const issuer = ctx.tx[sfAccount];
AccountID const holder = ctx.tx[sfHolder];

Expand All @@ -53,22 +57,18 @@ AMMClawback::preflight(PreflightContext const& ctx)
}

std::optional<STAmount> const clawAmount = ctx.tx[~sfAmount];
auto const& asset = ctx.tx[sfAsset];
auto const& asset2 = ctx.tx[sfAsset2];
auto const& flags = ctx.tx.getFlags();
auto const asset = ctx.tx[sfAsset];
auto const asset2 = ctx.tx[sfAsset2];

if (isXRP(asset))
return temMALFORMED;

if (flags & tfAMMClawbackMask)
return temINVALID_FLAG;

if (flags & tfClawTwoAssets && asset.account != asset2.account)
{
JLOG(ctx.j.trace())
<< "AMMClawback: tfClawTwoAssets can only be enabled when two "
"assets in the AMM pool are both issued by the issuer";
return temINVALID_FLAG;
return temMALFORMED;
}

if (asset.account != issuer)
Expand Down

0 comments on commit 0083a15

Please sign in to comment.