Cap the base fee for LoanPay based on loanMaximumPaymentsPerTransaction

This commit is contained in:
Ed Hennis
2026-04-17 19:06:52 -04:00
parent 653a383ff5
commit 669617af99

View File

@@ -132,6 +132,9 @@ LoanPay::calculateBaseFee(ReadView const& view, STTx const& tx)
auto const regularPayment = roundPeriodicPayment(asset, loanSle->at(sfPeriodicPayment), scale) +
loanSle->at(sfLoanServiceFee);
if (view.rules().enabled(fixSecurity3_1_3) &&
amount >= regularPayment * loanMaximumPaymentsPerTransaction)
return loanMaximumPaymentsPerTransaction * normalCost;
// If making an overpayment, count it as a full payment because it will do
// about the same amount of work, if not more.