Merge branch 'ximinez/lending-refactoring-3' into ximinez/lending-refactoring-4

This commit is contained in:
Ed Hennis
2025-09-22 11:26:20 -04:00
committed by GitHub
3 changed files with 18 additions and 7 deletions

View File

@@ -56,9 +56,12 @@ CreateOffer::checkExtraFeatures(PreflightContext const& ctx)
std::uint32_t
CreateOffer::getFlagsMask(PreflightContext const& ctx)
{
if (ctx.rules.enabled(featurePermissionedDEX) &&
ctx.tx.isFieldPresent(sfDomainID))
// The tfOfferCreateMask is built assuming that PermissionedDEX is
// enabled
if (ctx.rules.enabled(featurePermissionedDEX))
return tfOfferCreateMask;
// If PermissionedDEX is not enabled, add tfHybrid to the mask,
// indicating it is not allowed.
return tfOfferCreateMask | tfHybrid;
}
@@ -70,6 +73,9 @@ CreateOffer::preflight(PreflightContext const& ctx)
std::uint32_t const uTxFlags = tx.getFlags();
if (tx.isFlag(tfHybrid) && !tx.isFieldPresent(sfDomainID))
return temINVALID_FLAG;
bool const bImmediateOrCancel(uTxFlags & tfImmediateOrCancel);
bool const bFillOrKill(uTxFlags & tfFillOrKill);

View File

@@ -44,8 +44,11 @@ DeleteAccount::checkExtraFeatures(PreflightContext const& ctx)
if (!ctx.rules.enabled(featureDeletableAccounts))
return false;
return !ctx.tx.isFieldPresent(sfCredentialIDs) ||
ctx.rules.enabled(featureCredentials);
if (ctx.tx.isFieldPresent(sfCredentialIDs) &&
!ctx.rules.enabled(featureCredentials))
return false;
return true;
}
NotTEC

View File

@@ -36,10 +36,12 @@ DepositPreauth::checkExtraFeatures(PreflightContext const& ctx)
bool const authArrPresent = ctx.tx.isFieldPresent(sfAuthorizeCredentials);
bool const unauthArrPresent =
ctx.tx.isFieldPresent(sfUnauthorizeCredentials);
int const authCredPresent =
static_cast<int>(authArrPresent) + static_cast<int>(unauthArrPresent);
bool const authCredPresent = authArrPresent || unauthArrPresent;
return !authCredPresent || ctx.rules.enabled(featureCredentials);
if (authCredPresent && !ctx.rules.enabled(featureCredentials))
return false;
return true;
}
NotTEC