Error codes change in accountHolds must be amendment gated

This commit is contained in:
Bronek Kozicki
2025-03-10 14:29:01 +00:00
parent 65fdac09b3
commit 8ca6a62b84

View File

@@ -482,14 +482,26 @@ accountHolds(
{
amount = STAmount{mptIssue, sleMpt->getFieldU64(sfMPTAmount)};
// only if auth check is needed, as it needs to do an additional read
// operation
if (zeroIfUnauthorized == ahZERO_IF_UNAUTHORIZED)
// Only if auth check is needed, as it needs to do an additional read
// operation. Note featureSingleAssetVault will affect error codes.
if (zeroIfUnauthorized == ahZERO_IF_UNAUTHORIZED &&
view.rules().enabled(featureSingleAssetVault))
{
if (auto const err = requireAuth(view, mptIssue, account);
!isTesSuccess(err))
amount.clear(mptIssue);
}
else if (zeroIfUnauthorized == ahZERO_IF_UNAUTHORIZED)
{
auto const sleIssuance =
view.read(keylet::mptIssuance(mptIssue.getMptID()));
// if auth is enabled on the issuance and mpt is not authorized,
// clear amount
if (sleIssuance && sleIssuance->isFlag(lsfMPTRequireAuth) &&
!sleMpt->isFlag(lsfMPTAuthorized))
amount.clear(mptIssue);
}
}
return amount;