The XRP Ledger's lending protocol is in for a tidy-up of how loan repayments get rounded. In plain terms, the balance after each payment would match the schedule, the update has been discribed in the official Github pull request.
After an overpayment, TotalValueOutstanding is reset to the scheduled value of the new PeriodicPayment.
Under the LendingProtocolV1_2 amendment, each on-time LoanPay would bring TotalValueOutstanding down to the scheduled value with one payment fewer, capped at the rounded PeriodicPayment.
Technical Details
The first commit moves the scheduled-value calculation out of computeLoanProperties into a separate scheduledValue function, with no behavior change.
That way, LoanSet and LoanPay round it the same way. Zero-interest loans also need a floor on the principal part, because their value is rounded to nearest while the principal is rounded up. Tests run on Legacy, CashBasis and FixedPrecision vaults, with and without the amendment.
Today, each payment's value part is calculated on its own, so rounding can build up across payments. The last payment can then need one unit more than the rounded PeriodicPayment, and the value parts can alternate between payments.
With the change, a method called telescoping makes the value part of every on-time payment either the floor or the ceiling of PeriodicPayment, and at least one unit. The last payment becomes exactly the rounded PeriodicPayment.
What It Means for Users
There's little to no effect for users and investors today. The extra unit on the final payment changes little. Older loans that already carried one unit above their schedule simply keep it, so the last payment still needs the PeriodicPayment and a single unit, unless the borrower overpays first.
Small overpayments are mostly ignored; the transaction goes through successfully and charges no extra XRP whatsoever.
Activation date is yet to be determined: 80% of validators agreement is needed for two weeks in a row for the amendment to go through. No public vote for LendingProtocolV1_2 has been announced yet, so the timeline remains uncertain.