mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 14:20:56 +00:00
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.
This commit is contained in:
@@ -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<SField const*> 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};
|
||||
|
||||
Reference in New Issue
Block a user