diff --git a/include/xrpl/ledger/helpers/AccountRootHelpers.h b/include/xrpl/ledger/helpers/AccountRootHelpers.h index 350fc6ca85..5c9c89a219 100644 --- a/include/xrpl/ledger/helpers/AccountRootHelpers.h +++ b/include/xrpl/ledger/helpers/AccountRootHelpers.h @@ -15,7 +15,6 @@ #include #include #include -#include #include namespace xrpl { @@ -359,8 +358,8 @@ pseudoAccountAddress(ReadView const& view, uint256 const& pseudoOwnerKey); getPseudoAccountFields(); /** - * Returns true if and only if sleAcct is a pseudo-account or specific - * pseudo-accounts in pseudoFieldFilter. + * Returns true if and only if sleAcct is a pseudo-account of any kind + * (i.e. carries at least one field flagged with SField::sMD_PseudoAccount). * * Returns false if sleAcct is: * - NOT a pseudo-account OR @@ -368,18 +367,15 @@ getPseudoAccountFields(); * - null pointer */ [[nodiscard]] bool -isPseudoAccount(SLE::const_pointer sleAcct, std::set const& pseudoFieldFilter = {}); +isPseudoAccount(SLE::const_pointer sleAcct); /** * Convenience overload that reads the account from the view. */ [[nodiscard]] inline bool -isPseudoAccount( - ReadView const& view, - AccountID const& accountId, - std::set const& pseudoFieldFilter = {}) +isPseudoAccount(ReadView const& view, AccountID const& accountId) { - return isPseudoAccount(view.read(keylet::account(accountId)), pseudoFieldFilter); + return isPseudoAccount(view.read(keylet::account(accountId))); } /** diff --git a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp index faca4ebfb6..a555be3bc1 100644 --- a/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp +++ b/src/libxrpl/ledger/helpers/AccountRootHelpers.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -547,18 +546,14 @@ getPseudoAccountFields() } [[nodiscard]] bool -isPseudoAccount(SLE::const_pointer sleAcct, std::set const& pseudoFieldFilter) +isPseudoAccount(SLE::const_pointer sleAcct) { - auto const& fields = getPseudoAccountFields(); - // Intentionally use defensive coding here because it's cheap and makes the // semantics of true return value clean. return sleAcct && sleAcct->getType() == ltACCOUNT_ROOT && - std::count_if( - fields.begin(), fields.end(), [&sleAcct, &pseudoFieldFilter](SField const* sf) -> bool { - return sleAcct->isFieldPresent(*sf) && - (pseudoFieldFilter.empty() || pseudoFieldFilter.contains(sf)); - }) > 0; + std::ranges::any_of(getPseudoAccountFields(), [&sleAcct](SField const* sf) { + return sleAcct->isFieldPresent(*sf); + }); } std::expected diff --git a/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp b/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp index b239d0d3d1..a5455a8de3 100644 --- a/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp +++ b/src/libxrpl/ledger/helpers/MPTokenHelpers.cpp @@ -332,8 +332,7 @@ requireAuth( // They are implicitly authorized for any MPT they hold, including vault shares whose // underlying asset would otherwise require auth. auto const isPseudoAccountExempt = [&] { - return (featureSAVEnabled || featureMPTV2Enabled) && - isPseudoAccount(view, account, {&sfVaultID, &sfLoanBrokerID, &sfAMMID}); + return (featureSAVEnabled || featureMPTV2Enabled) && isPseudoAccount(view, account); }; auto const mptID = keylet::mptokenIssuance(mptIssue.getMptID()); diff --git a/src/libxrpl/tx/invariants/MPTInvariant.cpp b/src/libxrpl/tx/invariants/MPTInvariant.cpp index 12ec078c82..5e6c379af8 100644 --- a/src/libxrpl/tx/invariants/MPTInvariant.cpp +++ b/src/libxrpl/tx/invariants/MPTInvariant.cpp @@ -819,7 +819,7 @@ ValidMPTTransfer::isAuthorized( // auth. Exempt them here rather than relying on requireAuth: the recursive // share -> underlying descent in requireAuth fails for a pseudo-account // that holds the share but not the underlying. - if (isPseudoAccount(view, holder, {&sfVaultID, &sfLoanBrokerID, &sfAMMID})) + if (isPseudoAccount(view, holder)) return true; auto const key = keylet::mptoken(mptid, holder); diff --git a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp index 0aeb6f33d1..2204f5ec91 100644 --- a/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp +++ b/src/libxrpl/tx/transactors/token/MPTokenAuthorize.cpp @@ -153,7 +153,7 @@ MPTokenAuthorize::preclaim(PreclaimContext const& ctx) // always authorized. No need to amendment gate since Vault and LoanBroker // can only be created if the Vault amendment is enabled; AMM with MPToken asset // can only be created if MPTokensV2 is enabled. - if (isPseudoAccount(ctx.view, *holderID, {&sfVaultID, &sfLoanBrokerID, &sfAMMID})) + if (isPseudoAccount(ctx.view, *holderID)) return tecNO_PERMISSION; return tesSUCCESS;