mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Revert "Partially revert aed8e2b166 Fill in payment computation shortages (#5941)"
This reverts commit 95fdbe520f.
This commit is contained in:
@@ -2674,7 +2674,6 @@ protected:
|
|||||||
state.paymentRemaining,
|
state.paymentRemaining,
|
||||||
broker.params.managementFeeRate);
|
broker.params.managementFeeRate);
|
||||||
|
|
||||||
#if LOANFILLSHORTAGE
|
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
paymentComponents.trackedValueDelta ==
|
paymentComponents.trackedValueDelta ==
|
||||||
roundedPeriodicPayment ||
|
roundedPeriodicPayment ||
|
||||||
@@ -2682,11 +2681,6 @@ protected:
|
|||||||
detail::PaymentSpecialCase::final &&
|
detail::PaymentSpecialCase::final &&
|
||||||
paymentComponents.trackedValueDelta <
|
paymentComponents.trackedValueDelta <
|
||||||
roundedPeriodicPayment));
|
roundedPeriodicPayment));
|
||||||
#else
|
|
||||||
BEAST_EXPECT(
|
|
||||||
paymentComponents.trackedValueDelta <=
|
|
||||||
roundedPeriodicPayment);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ripple::LoanState const nextTrueState =
|
ripple::LoanState const nextTrueState =
|
||||||
calculateRawLoanState(
|
calculateRawLoanState(
|
||||||
|
|||||||
@@ -1215,7 +1215,6 @@ computePaymentComponents(
|
|||||||
"ripple::detail::computePaymentComponents",
|
"ripple::detail::computePaymentComponents",
|
||||||
"excess non-negative");
|
"excess non-negative");
|
||||||
};
|
};
|
||||||
#if LOANFILLSHORTAGE
|
|
||||||
auto giveTo =
|
auto giveTo =
|
||||||
[](Number& component, Number& shortage, Number const& maximum) {
|
[](Number& component, Number& shortage, Number const& maximum) {
|
||||||
if (shortage > beast::zero)
|
if (shortage > beast::zero)
|
||||||
@@ -1233,14 +1232,12 @@ computePaymentComponents(
|
|||||||
"ripple::detail::computePaymentComponents",
|
"ripple::detail::computePaymentComponents",
|
||||||
"excess non-negative");
|
"excess non-negative");
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
auto addressExcess = [&takeFrom](LoanDeltas& deltas, Number& excess) {
|
auto addressExcess = [&takeFrom](LoanDeltas& deltas, Number& excess) {
|
||||||
// This order is based on where errors are the least problematic
|
// This order is based on where errors are the least problematic
|
||||||
takeFrom(deltas.interestDueDelta, excess);
|
takeFrom(deltas.interestDueDelta, excess);
|
||||||
takeFrom(deltas.managementFeeDueDelta, excess);
|
takeFrom(deltas.managementFeeDueDelta, excess);
|
||||||
takeFrom(deltas.principalDelta, excess);
|
takeFrom(deltas.principalDelta, excess);
|
||||||
};
|
};
|
||||||
#if LOANFILLSHORTAGE
|
|
||||||
auto addressShortage = [&giveTo](
|
auto addressShortage = [&giveTo](
|
||||||
LoanDeltas& deltas,
|
LoanDeltas& deltas,
|
||||||
Number& shortage,
|
Number& shortage,
|
||||||
@@ -1250,7 +1247,6 @@ computePaymentComponents(
|
|||||||
giveTo(
|
giveTo(
|
||||||
deltas.managementFeeDueDelta, shortage, current.managementFeeDue);
|
deltas.managementFeeDueDelta, shortage, current.managementFeeDue);
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
Number totalOverpayment =
|
Number totalOverpayment =
|
||||||
deltas.valueDelta() - currentLedgerState.valueOutstanding;
|
deltas.valueDelta() - currentLedgerState.valueOutstanding;
|
||||||
if (totalOverpayment > beast::zero)
|
if (totalOverpayment > beast::zero)
|
||||||
@@ -1279,7 +1275,6 @@ computePaymentComponents(
|
|||||||
|
|
||||||
shortage = -excess;
|
shortage = -excess;
|
||||||
}
|
}
|
||||||
#if LOANFILLSHORTAGE
|
|
||||||
else if (shortage > beast::zero && totalOverpayment < beast::zero)
|
else if (shortage > beast::zero && totalOverpayment < beast::zero)
|
||||||
{
|
{
|
||||||
// If there's a shortage, and there's room in the loan itself, we can
|
// If there's a shortage, and there's room in the loan itself, we can
|
||||||
@@ -1297,16 +1292,6 @@ computePaymentComponents(
|
|||||||
shortage == beast::zero,
|
shortage == beast::zero,
|
||||||
"ripple::detail::computePaymentComponents",
|
"ripple::detail::computePaymentComponents",
|
||||||
"no shortage or excess");
|
"no shortage or excess");
|
||||||
#else
|
|
||||||
// The shortage should never be negative, which indicates that the
|
|
||||||
// parts are trying to take more than the whole payment. The
|
|
||||||
// shortage may be positive, which indicates that we're not going to
|
|
||||||
// take the whole payment amount.
|
|
||||||
XRPL_ASSERT_PARTS(
|
|
||||||
shortage >= beast::zero,
|
|
||||||
"ripple::detail::computePaymentComponents",
|
|
||||||
"no shortage or excess");
|
|
||||||
#endif
|
|
||||||
#if LOANCOMPLETE
|
#if LOANCOMPLETE
|
||||||
/*
|
/*
|
||||||
// This used to be part of the above assert. It will eventually be removed
|
// This used to be part of the above assert. It will eventually be removed
|
||||||
|
|||||||
Reference in New Issue
Block a user