From ed606591a43ea6e0d8a4c84a35015754759188ec Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Mon, 24 Aug 2026 13:10:43 +0200 Subject: [PATCH] review: LendingHelpers_test uses closed-ended vault under LP V1.1 Instead of disabling featureLendingProtocolV1_1 in testLoanDefaultFreezeExemptAccounts, keep the amendment enabled and build a closed-ended vault with SubscriptionDate / RedemptionDate. The test still exercises the same LoanDefault code path but now runs against the vault kind LP V1.1 actually requires for loan brokers. --- src/test/app/lending/LendingHelpers_test.cpp | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/test/app/lending/LendingHelpers_test.cpp b/src/test/app/lending/LendingHelpers_test.cpp index 0dd445b497..abd6790dbc 100644 --- a/src/test/app/lending/LendingHelpers_test.cpp +++ b/src/test/app/lending/LendingHelpers_test.cpp @@ -1896,22 +1896,32 @@ public: Account const lender{"lender"}; Account const borrower{"borrower"}; - // featureLendingProtocolV1_1 adds a closed-ended vault gate on - // LoanBrokerSet::preclaim (see LoanBrokerSet.cpp). This test uses - // an open-ended vault, which is fine under pre-LP V1.1 semantics - // but would be rejected under the amendment. Strip the amendment - // to preserve the pre-LP V1.1 behaviour this test asserts. - Env env{*this, jtx::testableAmendments() - featureLendingProtocolV1_1}; + Env env{*this}; Vault const vault{env}; env.fund(XRP(10'000), lender, borrower); env.close(); - auto [vaultTx, vaultKeylet] = vault.create({.owner = lender, .asset = xrpIssue()}); + // Under featureLendingProtocolV1_1 LoanBrokerSet::preclaim only + // accepts closed-ended vaults, so build one with a near-future + // SubscriptionDate, deposit while still in the Subscription phase, + // and advance past SubscriptionDate before creating the broker. + using dur = NetClock::duration; + using tp = NetClock::time_point; + auto const sub = static_cast(env.now().time_since_epoch().count()) + 10u; + auto const red = sub + 1'000'000u; + auto [vaultTx, vaultKeylet] = vault.create( + {.owner = lender, + .asset = xrpIssue(), + .vaultKind = std::to_underlying(VaultKind::ClosedEnded), + .subscriptionDate = sub, + .redemptionDate = red}); env(vaultTx); env.close(); env(vault.deposit({.depositor = lender, .id = vaultKeylet.key, .amount = XRP(1'000)})); env.close(); + env.close(tp{dur{sub + 1}}); + auto const brokerKeylet = keylet::loanBroker(lender.id(), SeqProxy::rawSequence(env.seq(lender))); env(loan_broker::set(lender, vaultKeylet.key));