Skip to content

Commit 156186d

Browse files
ximinezTapanito
andcommitted
Add comment to totalPaidToVaultForDebt in LoanPay.cpp
Co-authored-by: Vito Tumas <[email protected]>
1 parent 4c9a96a commit 156186d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ LoanPay::doApply()
388388
!asset.integral() || totalPaidToVaultRaw == totalPaidToVaultRounded,
389389
"ripple::LoanPay::doApply",
390390
"rounding does nothing for integral asset");
391+
// Account for value changes when reducing the broker's debt:
392+
// - Positive value change (from full/late/overpayments): Subtract from the
393+
// amount credited toward debt to avoid over-reducing the debt.
394+
// - Negative value change (from full/overpayments): Add to the amount
395+
// credited toward debt,effectively increasing the debt reduction.
391396
auto const totalPaidToVaultForDebt =
392397
totalPaidToVaultRaw - paymentParts->valueChange;
393398

0 commit comments

Comments
 (0)