mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Correct handling of LoanBroker.DebtMaximum zero values
- Addresses FIND-003 from audit. - Behavior changed to treat a DebtMaximum value of 0 to mean "no limit", as defined in spec. - No need to add unit tests, because the previous commit covers 0, and tests already exist for non-zero limits.
This commit is contained in:
@@ -243,7 +243,8 @@ LoanSet::preclaim(PreclaimContext const& ctx)
|
||||
return tecINSUFFICIENT_FUNDS;
|
||||
}
|
||||
auto const newDebtTotal = brokerSle->at(sfDebtTotal) + principalRequested;
|
||||
if (brokerSle->at(sfDebtMaximum) < newDebtTotal)
|
||||
if (auto const debtMaximum = brokerSle->at(sfDebtMaximum);
|
||||
debtMaximum != 0 && debtMaximum < newDebtTotal)
|
||||
{
|
||||
JLOG(ctx.j.warn())
|
||||
<< "Loan would exceed the maximum debt limit of the LoanBroker.";
|
||||
|
||||
Reference in New Issue
Block a user