From 58e459a4a01a42e91ce459397c412e21673117c2 Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Thu, 13 Aug 2026 13:58:15 +0200 Subject: [PATCH 1/2] fix: improve docs --- src/libxrpl/tx/transactors/lending/LoanManage.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libxrpl/tx/transactors/lending/LoanManage.cpp b/src/libxrpl/tx/transactors/lending/LoanManage.cpp index 7bccbd71ec..e3bc6bcbd8 100644 --- a/src/libxrpl/tx/transactors/lending/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanManage.cpp @@ -188,6 +188,11 @@ LoanManage::defaultLoan( // required to paper over the resulting cross-side mismatch -- a snap // that itself minted phantom assets on sfAssetsTotal. See the // sibling change in LoanPay for the same fix on the payment path. + // + // The Number-precision guard `T - A >= totalDefaultAmount` below is + // exactly sufficient: loanVaultExposure returns a difference of vault- + // associated STNumber fields (IOU-normalized via associateAsset), so + // its STAmount promotion round-trips losslessly with no writeOff slack. bool const useUnifiedAssetArithmetic = view.rules().enabled(fixCleanup3_4_0); if (useUnifiedAssetArithmetic) @@ -224,6 +229,11 @@ LoanManage::defaultLoan( vaultSle->at(sfAssetsTotal) += amount - writeOff; vaultSle->at(sfAssetsAvailable) += amount; + + XRPL_ASSERT_PARTS( + *vaultSle->at(sfAssetsAvailable) <= *vaultSle->at(sfAssetsTotal), + "xrpl::LoanManage::defaultLoan", + "assets available must not be greater than assets outstanding"); } else { From 8874a97b7fafd64426b629b0496ba4b93b4a2b0e Mon Sep 17 00:00:00 2001 From: Vito <5780819+Tapanito@users.noreply.github.com> Date: Thu, 13 Aug 2026 14:07:51 +0200 Subject: [PATCH 2/2] fix: clang-tidy --- src/libxrpl/tx/transactors/lending/LoanManage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libxrpl/tx/transactors/lending/LoanManage.cpp b/src/libxrpl/tx/transactors/lending/LoanManage.cpp index e3bc6bcbd8..3c5ddc3a0f 100644 --- a/src/libxrpl/tx/transactors/lending/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/lending/LoanManage.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include