test: Fix LoanBatch broker cover rates and schedule overflow (#7967)

This commit is contained in:
Vito Tumas
2026-08-12 13:42:55 +00:00
committed by Ed Hennis
parent af36890c11
commit 91360c5126

View File

@@ -473,14 +473,21 @@ protected:
TenthBips16 const managementFeeRate{managementFeeRateDist_(engine_)};
auto const serviceFee = serviceFeeDist_(engine_);
TenthBips32 interest{interestRateDist_(engine_)};
auto const payTotal = paymentTotalDist_(engine_);
auto payTotal = paymentTotalDist_(engine_);
auto const payInterval = paymentIntervalDist_(engine_);
// The end of the last payment's grace period must fit in a 32-bit
// ripple-epoch timestamp, or LoanSet fails with tecKILLED. Cap the
// schedule well below that horizon (2e9 seconds is roughly 63 years,
// leaving ample headroom over the ledger start date).
constexpr std::uint32_t kMaxScheduleSeconds = 2'000'000'000;
payTotal = std::min(payTotal, static_cast<int>(kMaxScheduleSeconds / payInterval));
BrokerParameters const brokerParams{
.vaultDeposit = principalRequest * 10,
.debtMax = 0,
.coverRateMin = TenthBips32{0},
.managementFeeRate = managementFeeRate};
.managementFeeRate = managementFeeRate,
.coverRateLiquidation = TenthBips32{0}};
LoanParameters const loanParams{
.account = lender,
.counter = borrower,