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

View File

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

View File

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