Skip to content

Commit 206b543

Browse files
committed
Revert "Partially revert aed8e2b Fill in payment computation shortages (#5941)"
This reverts commit 95fdbe5.
1 parent f528458 commit 206b543

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

src/test/app/Loan_test.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,19 +2663,13 @@ class Loan_test : public beast::unit_test::suite
26632663
state.paymentRemaining,
26642664
broker.params.managementFeeRate);
26652665

2666-
#if LOANFILLSHORTAGE
26672666
BEAST_EXPECT(
26682667
paymentComponents.trackedValueDelta ==
26692668
roundedPeriodicPayment ||
26702669
(paymentComponents.specialCase ==
26712670
detail::PaymentSpecialCase::final &&
26722671
paymentComponents.trackedValueDelta <
26732672
roundedPeriodicPayment));
2674-
#else
2675-
BEAST_EXPECT(
2676-
paymentComponents.trackedValueDelta <=
2677-
roundedPeriodicPayment);
2678-
#endif
26792673

26802674
ripple::LoanState const nextTrueState =
26812675
calculateRawLoanState(

src/xrpld/app/misc/detail/LendingHelpers.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,6 @@ computePaymentComponents(
12151215
"ripple::detail::computePaymentComponents",
12161216
"excess non-negative");
12171217
};
1218-
#if LOANFILLSHORTAGE
12191218
auto giveTo =
12201219
[](Number& component, Number& shortage, Number const& maximum) {
12211220
if (shortage > beast::zero)
@@ -1233,14 +1232,12 @@ computePaymentComponents(
12331232
"ripple::detail::computePaymentComponents",
12341233
"excess non-negative");
12351234
};
1236-
#endif
12371235
auto addressExcess = [&takeFrom](LoanDeltas& deltas, Number& excess) {
12381236
// This order is based on where errors are the least problematic
12391237
takeFrom(deltas.interestDueDelta, excess);
12401238
takeFrom(deltas.managementFeeDueDelta, excess);
12411239
takeFrom(deltas.principalDelta, excess);
12421240
};
1243-
#if LOANFILLSHORTAGE
12441241
auto addressShortage = [&giveTo](
12451242
LoanDeltas& deltas,
12461243
Number& shortage,
@@ -1250,7 +1247,6 @@ computePaymentComponents(
12501247
giveTo(
12511248
deltas.managementFeeDueDelta, shortage, current.managementFeeDue);
12521249
};
1253-
#endif
12541250
Number totalOverpayment =
12551251
deltas.valueDelta() - currentLedgerState.valueOutstanding;
12561252
if (totalOverpayment > beast::zero)
@@ -1279,7 +1275,6 @@ computePaymentComponents(
12791275

12801276
shortage = -excess;
12811277
}
1282-
#if LOANFILLSHORTAGE
12831278
else if (shortage > beast::zero && totalOverpayment < beast::zero)
12841279
{
12851280
// If there's a shortage, and there's room in the loan itself, we can
@@ -1297,16 +1292,6 @@ computePaymentComponents(
12971292
shortage == beast::zero,
12981293
"ripple::detail::computePaymentComponents",
12991294
"no shortage or excess");
1300-
#else
1301-
// The shortage should never be negative, which indicates that the
1302-
// parts are trying to take more than the whole payment. The
1303-
// shortage may be positive, which indicates that we're not going to
1304-
// take the whole payment amount.
1305-
XRPL_ASSERT_PARTS(
1306-
shortage >= beast::zero,
1307-
"ripple::detail::computePaymentComponents",
1308-
"no shortage or excess");
1309-
#endif
13101295
#if LOANCOMPLETE
13111296
/*
13121297
// This used to be part of the above assert. It will eventually be removed

0 commit comments

Comments
 (0)