Skip to content

Commit f8ee979

Browse files
committed
Review feedback from @gregtatcam
- Add a comment explaining the formula in LoanManage::owedToVault - Make owedToVault static
1 parent 1c38bbd commit f8ee979

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/xrpld/app/tx/detail/LoanManage.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,20 @@ LoanManage::preclaim(PreclaimContext const& ctx)
114114
return tesSUCCESS;
115115
}
116116

117-
Number
117+
static Number
118118
owedToVault(SLE::ref loanSle)
119119
{
120+
// Spec section 3.2.3.2, defines the default amount as
121+
//
122+
// DefaultAmount = (Loan.PrincipalOutstanding + Loan.InterestOutstanding)
123+
//
124+
// Loan.InterestOutstanding is not stored directly on ledger.
125+
// It is computed as
126+
//
127+
// Loan.TotalValueOutstanding - Loan.PrincipalOutstanding -
128+
// Loan.ManagementFeeOutstanding
129+
//
130+
// Add that to the original formula, and you get this:
120131
return loanSle->at(sfTotalValueOutstanding) -
121132
loanSle->at(sfManagementFeeOutstanding);
122133
}

0 commit comments

Comments
 (0)