Minor test fixes

- Don't deposit cover if the amount is 0.
- Handle missing next payment date in getCurrentState.
This commit is contained in:
Ed Hennis
2025-11-09 20:27:59 -05:00
parent 348e7f7cfc
commit 6e4f6eab3b

View File

@@ -473,7 +473,8 @@ protected:
coverRateMinimum(coverRateMinValue),
coverRateLiquidation(TenthBips32(params.coverRateLiquidation)));
env(coverDeposit(lender, keylet.key, coverDepositValue));
if (coverDepositValue != beast::zero)
env(coverDeposit(lender, keylet.key, coverDepositValue));
env.close();
@@ -496,7 +497,7 @@ protected:
return LoanState{
.previousPaymentDate = loan->at(sfPreviousPaymentDate),
.startDate = tp{d{loan->at(sfStartDate)}},
.nextPaymentDate = loan->at(sfNextPaymentDueDate),
.nextPaymentDate = loan->at(~sfNextPaymentDueDate).value_or(0),
.paymentRemaining = loan->at(sfPaymentRemaining),
.loanScale = loan->at(sfLoanScale),
.totalValue = loan->at(sfTotalValueOutstanding),