Skip to content

Commit

Permalink
remove unnecessary check
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyiqian1 committed Sep 19, 2024
1 parent ea1a6d9 commit 7a4429e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
43 changes: 0 additions & 43 deletions src/xrpld/app/tx/detail/InvariantCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,47 +931,4 @@ ValidClawback::finalize(
return true;
}

void
ValidAMMClawback::visitEntry(
bool,
std::shared_ptr<SLE const> const& before,
std::shared_ptr<SLE const> const&)
{
if (before && before->getType() == ltRIPPLE_STATE)
trustlinesChanged++;
}

bool
ValidAMMClawback::finalize(
STTx const& tx,
TER const result,
XRPAmount const,
ReadView const& view,
beast::Journal const& j)
{
if (tx.getTxnType() != ttAMM_CLAWBACK)
return true;

if (result == tesSUCCESS)
{
if (trustlinesChanged != 5)
{
JLOG(j.fatal()) << "Invariant failed: the number of trustlines "
"changed is not equal to five.";
return false;
}
}
else
{
if (trustlinesChanged != 0)
{
JLOG(j.fatal()) << "Invariant failed: some trustlines were changed "
"despite failure of the transaction.";
return false;
}
}

return true;
}

} // namespace ripple
23 changes: 0 additions & 23 deletions src/xrpld/app/tx/detail/InvariantCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,29 +450,6 @@ class ValidClawback
beast::Journal const&);
};

/**
* @brief Invariant: make sure five trustlines are affected by this transaction.
*/
class ValidAMMClawback
{
std::uint32_t trustlinesChanged = 0;

public:
void
visitEntry(
bool,
std::shared_ptr<SLE const> const&,
std::shared_ptr<SLE const> const&);

bool
finalize(
STTx const&,
TER const,
XRPAmount const,
ReadView const&,
beast::Journal const&);
};

// additional invariant checks can be declared above and then added to this
// tuple
using InvariantChecks = std::tuple<
Expand Down

0 comments on commit 7a4429e

Please sign in to comment.