From bea11fad425a45bdaca0353e8a4d449eeeb06436 Mon Sep 17 00:00:00 2001 From: Timur Ialymov Date: Tue, 18 Aug 2026 18:58:28 +0100 Subject: [PATCH] refactor: Hoist the pseudo-account field filter out of the auth check The filter is constant, but building it inline meant a fresh std::set on every IOU authorization check that reached the unauthorized-line branch, including the ones on the trading paths. Build it once instead. It is a function-local static rather than a namespace-scope one because the SFields it points at are defined in another translation unit. --- src/libxrpl/ledger/helpers/RippleStateHelpers.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp index 12bd913a29..8ad31d39a1 100644 --- a/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp +++ b/src/libxrpl/ledger/helpers/RippleStateHelpers.cpp @@ -593,8 +593,12 @@ requireAuth(ReadView const& view, Issue const& issue, AccountID const& account, // can never authorize its own line and no transaction offers the // issuer a chance to do it either. Treat a line it already owns as // authorized, the same way MPT does. + // + // Function-local rather than namespace scope: the SFields it points + // at live in another translation unit. + static std::set const kPseudoAccountFilter{&sfVaultID, &sfLoanBrokerID}; if (view.rules().enabled(fixCleanup3_4_0) && - isPseudoAccount(view, account, {&sfVaultID, &sfLoanBrokerID})) + isPseudoAccount(view, account, kPseudoAccountFilter)) return tesSUCCESS; return TER{tecNO_AUTH};