mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 16:26:48 +00:00
address reviewer feedback
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
// Macros below are copied from antithesis_sdk.h and slightly simplified
|
||||
// The duplication is because Visual Studio 2019 cannot compile that header
|
||||
// even with the option -Zc:__cplusplus added.
|
||||
// // NOTE: cond must not contain bare commas outside () or []. Commas inside {}
|
||||
// are not protected by the preprocessor and would be parsed as extra arguments.
|
||||
#define ALWAYS(cond, message, ...) assert((message) && (cond))
|
||||
#define ALWAYS_OR_UNREACHABLE(cond, message) assert((message) && (cond))
|
||||
#define SOMETIMES(cond, message, ...)
|
||||
@@ -21,15 +23,13 @@
|
||||
#define XRPL_ASSERT ALWAYS_OR_UNREACHABLE
|
||||
#define XRPL_ASSERT_PARTS(cond, function, description, ...) \
|
||||
XRPL_ASSERT(cond, function " : " description)
|
||||
// clang-format off
|
||||
// NOTE: cond must not contain bare commas outside () or []. Commas inside {}
|
||||
// are not protected by the preprocessor and would be parsed as extra arguments.
|
||||
|
||||
#define XRPL_ASSERT_IF(guard, cond, message) \
|
||||
do { \
|
||||
do \
|
||||
{ \
|
||||
if ((guard)) \
|
||||
XRPL_ASSERT(cond, message); \
|
||||
} while (false)
|
||||
// clang-format on
|
||||
|
||||
// How to use the instrumentation macros:
|
||||
//
|
||||
|
||||
@@ -822,15 +822,14 @@ doOverpayment(
|
||||
|
||||
XRPL_ASSERT_IF(
|
||||
fix320Enabled,
|
||||
loanPaymentParts.valueChange ==
|
||||
[&] {
|
||||
Number const tvoChange = newRoundedLoanState.valueOutstanding -
|
||||
(totalValueOutstandingProxy - overpaymentComponents.trackedPrincipalDelta);
|
||||
Number const managementFeeReleased =
|
||||
managementFeeOutstandingProxy - newRoundedLoanState.managementFeeDue;
|
||||
Number const interestPart = overpaymentComponents.trackedInterestPart();
|
||||
return tvoChange + managementFeeReleased + interestPart;
|
||||
}(),
|
||||
[&] {
|
||||
Number const tvoChange = newRoundedLoanState.valueOutstanding -
|
||||
(totalValueOutstandingProxy - overpaymentComponents.trackedPrincipalDelta);
|
||||
Number const managementFeeReleased =
|
||||
managementFeeOutstandingProxy - newRoundedLoanState.managementFeeDue;
|
||||
Number const interestPart = overpaymentComponents.trackedInterestPart();
|
||||
return loanPaymentParts.valueChange == tvoChange + managementFeeReleased + interestPart;
|
||||
}(),
|
||||
"xrpl::detail::doOverpayment : interest paid agrees");
|
||||
|
||||
XRPL_ASSERT_IF(
|
||||
|
||||
Reference in New Issue
Block a user