Skip to content

Commit d258a0c

Browse files
committed
fixes fee increment calculation for loan payment
1 parent 27200ab commit d258a0c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/xrpld/app/tx/detail/LoanPay.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ LoanPay::calculateBaseFee(ReadView const& view, STTx const& tx)
109109
NumberRoundModeGuard mg(
110110
tx.isFlag(tfLoanOverpayment) ? Number::upward : Number::downward);
111111
// Estimate how many payments will be made
112-
Number const numPaymentEstimate =
113-
static_cast<std::int64_t>(amount / regularPayment);
112+
Number const numPaymentEstimate = std::min(
113+
static_cast<std::int64_t>(amount / regularPayment),
114+
Lending::loanMaximumPaymentsPerTransaction);
114115

115116
// Charge one base fee per paymentsPerFeeIncrement payments, rounding up.
116117
Number::setround(Number::upward);

0 commit comments

Comments
 (0)