mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-28 15:58:07 +00:00
The clamp block added in VaultWithdraw::doApply unconditionally returned tecPRECISION_LOSS when the clamped payout was zero. That undid the develop-side guard that deliberately permits fixed-share zero-asset withdrawals in a fully-impaired vault (assetsTotalForWithdrawal == 0), causing xrpl.tx.LoanRounding to fail on all three build-test configs (linux-clang, linux-gcc-coverage, windows). Skip the clamp when assetsWithdrawn is already zero, and also on the final-withdrawal path where the value is overwritten with sfAssetsAvailable a few lines later. Also addresses review feedback: - Correct clampToAssetsTotalScale docstring to reflect that it returns a non-negative magnitude; the caller applies the sign. - Add XRPL_ASSERT precondition matching sibling helpers, and canonicalize totalBefore/totalAfter under a single NumberRoundModeGuard so the returned delta reflects only `delta`, not a rounding difference between the two endpoints. - Move VaultPrecisionFixture.h and VaultTransactorPrecision_test.cpp from src/test/app/lending/ to src/test/app/vault/ so vault tests live alongside the other vault-specific suites. - Simplify inline commentary across VaultDeposit/VaultWithdraw/ VaultClawback.