From 590f69cd4c340950c49f6b0818e7c54aabea4167 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Sat, 22 Nov 2025 22:23:27 -0400 Subject: [PATCH] Add comment to totalPaidToVaultForDebt in LoanPay.cpp Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com> --- src/xrpld/app/tx/detail/LoanPay.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index 0b7a3ed0dd..95a13d2fcc 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -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;