mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Commit 26f82a2a1 swapped `computePaymentFactor` from the cancellation-prone
`power(1+r, n) - 1` to `computePowerMinusOneHybrid`, but did not
amendment-gate the swap. Because the change alters the bit-pattern of
amortization output at near-zero rates, applying it without a gate would
fork consensus on any ledger with a long-running near-zero-rate loan.
Gate the hybrid path on `fixCleanup3_2_0`. When the amendment is not
enabled, `computePaymentFactor` falls back to the original direct
subtraction, preserving pre-fix output bit-exactly. When enabled, the
hybrid path is used and the near-zero-rate regression tests
(`testBugInterestDueDeltaCrash`, `testFullLifecycleVaultPnLNearZeroRate`)
pass.
Threads `Rules const&` from the public lending API down to
`computePaymentFactor`:
- `computePaymentFactor`, `loanPeriodicPayment`,
`loanPrincipalFromPeriodicPayment` (leaves)
- `computeTheoreticalLoanState`, `computeFullPayment`,
`computePaymentComponents` (mid-level)
- `computeLoanProperties` (both overloads), `tryOverpayment`,
`doOverpayment` (top-level)
Public callers (`LoanSet::doApply`, `loanMakePayment`) pass
`view.rules()`. Tests pass `env.current()->rules()`.