From 30732882f1b3aa7923e89d0529c022b7d8cdb2f0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 29 Jun 2026 17:34:38 +0100 Subject: [PATCH] fix: Make Loan and LoanBroker filterable in account_objects/ledger_data (#3124) --- src/util/LedgerUtils.hpp | 7 +++++++ tests/unit/util/LedgerUtilsTests.cpp | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/util/LedgerUtils.hpp b/src/util/LedgerUtils.hpp index 037116d7a..22b5d4ab2 100644 --- a/src/util/LedgerUtils.hpp +++ b/src/util/LedgerUtils.hpp @@ -143,6 +143,13 @@ class LedgerTypes { xrpl::ltCREDENTIAL ), LedgerTypeAttribute::accountOwnedLedgerType(JS(Vault), JS(vault), xrpl::ltVAULT), + // loan broker is a pseudo-account object, like AMM and Vault + LedgerTypeAttribute::accountOwnedLedgerType( + JS(LoanBroker), + JS(loan_broker), + xrpl::ltLOAN_BROKER + ), + LedgerTypeAttribute::deletionBlockerLedgerType(JS(Loan), JS(loan), xrpl::ltLOAN), LedgerTypeAttribute::chainLedgerType(JS(NegativeUNL), JS(nunl), xrpl::ltNEGATIVE_UNL), LedgerTypeAttribute::deletionBlockerLedgerType( JS(MPTokenIssuance), diff --git a/tests/unit/util/LedgerUtilsTests.cpp b/tests/unit/util/LedgerUtilsTests.cpp index b8ed6d7c1..7e6938890 100644 --- a/tests/unit/util/LedgerUtilsTests.cpp +++ b/tests/unit/util/LedgerUtilsTests.cpp @@ -41,6 +41,8 @@ TEST(LedgerUtilsTests, LedgerObjectTypeList) JS(oracle), JS(credential), JS(vault), + JS(loan_broker), + JS(loan), JS(nunl), JS(delegate) }; @@ -81,7 +83,8 @@ TEST(LedgerUtilsTests, DeletionBlockerTypes) xrpl::ltBRIDGE, xrpl::ltMPTOKEN_ISSUANCE, xrpl::ltMPTOKEN, - xrpl::ltPERMISSIONED_DOMAIN + xrpl::ltPERMISSIONED_DOMAIN, + xrpl::ltLOAN }; static_assert(std::size(kDeletionBlockers) == kTestedTypes.size()); @@ -137,6 +140,8 @@ static LedgerEntryTypeParam const kAccountOwnedTestCases[] = { {.input = "mptoken", .expected = xrpl::ltMPTOKEN}, {.input = "permissioned_domain", .expected = xrpl::ltPERMISSIONED_DOMAIN}, {.input = "vault", .expected = xrpl::ltVAULT}, + {.input = "loan_broker", .expected = xrpl::ltLOAN_BROKER}, + {.input = "loan", .expected = xrpl::ltLOAN}, {.input = "delegate", .expected = xrpl::ltDELEGATE}, // Using canonical name with exact match @@ -163,6 +168,8 @@ static LedgerEntryTypeParam const kAccountOwnedTestCases[] = { {.input = "MPToken", .expected = xrpl::ltMPTOKEN}, {.input = "PermissionedDomain", .expected = xrpl::ltPERMISSIONED_DOMAIN}, {.input = "Vault", .expected = xrpl::ltVAULT}, + {.input = "LoanBroker", .expected = xrpl::ltLOAN_BROKER}, + {.input = "Loan", .expected = xrpl::ltLOAN}, {.input = "Delegate", .expected = xrpl::ltDELEGATE} };