From 71e2d2c630b06e913ce4e63b84c93af092affdee Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Fri, 14 Aug 2026 12:22:51 +0200 Subject: [PATCH] test: Fix LoanCoverFreezeAuth default-after-impair for impair-must-be-late testLoanDefaultBypassesMptLockAfterImpair impaired the loan before its first payment came due, which trips the featureLendingProtocolV1_1 impairLoan guard (tecTOO_SOON) added by tapanito/lending-impairment. Advance past sfNextPaymentDueDate before impairing, matching the pattern used in the Loan_test.cpp fixes. --- src/test/app/lending/LoanCoverFreezeAuth_test.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/app/lending/LoanCoverFreezeAuth_test.cpp b/src/test/app/lending/LoanCoverFreezeAuth_test.cpp index b0c43190c5..0ca3185ff0 100644 --- a/src/test/app/lending/LoanCoverFreezeAuth_test.cpp +++ b/src/test/app/lending/LoanCoverFreezeAuth_test.cpp @@ -460,6 +460,16 @@ private: auto const loanKeylet = keylet::loan(brokerInfo.brokerID, SeqProxy::rawSequence(1)); + using tp = NetClock::time_point; + using d = NetClock::duration; + + // Under featureLendingProtocolV1_1, a loan can only be impaired once + // its payment is late. + if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) + { + env.close(tp{d{loan->at(sfNextPaymentDueDate) + 1}}); + } + // Realize a loss via impairment before locking. env(manage(lender, loanKeylet.key, tfLoanImpair)); env.close(); @@ -472,8 +482,6 @@ private: env(pay(borrower, loanKeylet.key, debtMaximumRequest), Ter(tecLOCKED)); env.close(); - using tp = NetClock::time_point; - using d = NetClock::duration; if (auto loan = env.le(loanKeylet); BEAST_EXPECT(loan)) { env.close(tp{d{loan->at(sfNextPaymentDueDate) + loan->at(sfGracePeriod) + 1}});