Skip to content

Commit

Permalink
Switch from assert to XRPL_ASSERT (#5245)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek authored Jan 23, 2025
1 parent 409c1d5 commit 3868c04
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ PermissionedDomainDelete::preclaim(PreclaimContext const& ctx)
if (!sleDomain)
return tecNO_ENTRY;

assert(
sleDomain->isFieldPresent(sfOwner) && ctx.tx.isFieldPresent(sfAccount));
XRPL_ASSERT(
sleDomain->isFieldPresent(sfOwner) && ctx.tx.isFieldPresent(sfAccount),
"ripple::PermissionedDomainDelete::preclaim : required fields present");
if (sleDomain->getAccountID(sfOwner) != ctx.tx.getAccountID(sfAccount))
return tecNO_PERMISSION;

Expand All @@ -66,7 +67,9 @@ PermissionedDomainDelete::preclaim(PreclaimContext const& ctx)
TER
PermissionedDomainDelete::doApply()
{
assert(ctx_.tx.isFieldPresent(sfDomainID));
XRPL_ASSERT(
ctx_.tx.isFieldPresent(sfDomainID),
"ripple::PermissionedDomainDelete::doApply : required field present");

auto const slePd =
view().peek({ltPERMISSIONED_DOMAIN, ctx_.tx.at(sfDomainID)});
Expand All @@ -80,7 +83,9 @@ PermissionedDomainDelete::doApply()
}

auto const ownerSle = view().peek(keylet::account(account_));
assert(ownerSle && ownerSle->getFieldU32(sfOwnerCount) > 0);
XRPL_ASSERT(
ownerSle && ownerSle->getFieldU32(sfOwnerCount) > 0,
"ripple::PermissionedDomainDelete::doApply : nonzero owner count");
adjustOwnerCount(view(), ownerSle, -1, ctx_.journal);
view().erase(slePd);

Expand Down

0 comments on commit 3868c04

Please sign in to comment.