Add comment to totalPaidToVaultForDebt in LoanPay.cpp

Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
This commit is contained in:
Ed Hennis
2025-11-22 22:23:27 -04:00
parent 4c9a96a17b
commit 590f69cd4c

View File

@@ -388,6 +388,11 @@ LoanPay::doApply()
!asset.integral() || totalPaidToVaultRaw == totalPaidToVaultRounded,
"ripple::LoanPay::doApply",
"rounding does nothing for integral asset");
// Account for value changes when reducing the broker's debt:
// - Positive value change (from full/late/overpayments): Subtract from the
// amount credited toward debt to avoid over-reducing the debt.
// - Negative value change (from full/overpayments): Add to the amount
// credited toward debt,effectively increasing the debt reduction.
auto const totalPaidToVaultForDebt =
totalPaidToVaultRaw - paymentParts->valueChange;