mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-05 22:45:35 +00:00
Compare commits
8 Commits
ximinez/di
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fb832f886 | ||
|
|
0a626d95f4 | ||
|
|
6006c281e2 | ||
|
|
e79673cf40 | ||
|
|
1c59ac3e11 | ||
|
|
aea548b2b9 | ||
|
|
f4e1f71b7a | ||
|
|
136ec1ca9e |
@@ -22,6 +22,12 @@ API version 2 is available in `rippled` version 2.0.0 and later. See [API-VERSIO
|
||||
|
||||
This version is supported by all `rippled` versions. For WebSocket and HTTP JSON-RPC requests, it is currently the default API version used when no `api_version` is specified.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- Peer Crawler: The `port` field in `overlay.active[]` now consistently returns an integer instead of a string for outbound peers. [#6318](https://github.com/XRPLF/rippled/pull/6318)
|
||||
|
||||
## XRP Ledger server version 3.1.0
|
||||
|
||||
[Version 3.1.0](https://github.com/XRPLF/rippled/releases/tag/3.1.0) was released on Jan 27, 2026.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
|
||||
"soci/4.0.3#a9f8d773cd33e356b5879a4b0564f287%1765850149.46",
|
||||
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
|
||||
"secp256k1/0.7.0#0fda78daa3b864deb8a2fbc083398356%1770226294.524",
|
||||
"secp256k1/0.7.1#3a61e95e220062ef32c48d019e9c81f7%1770306721.686",
|
||||
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
|
||||
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103",
|
||||
"protobuf/6.32.1#f481fd276fc23a33b85a3ed1e898b693%1765850161.038",
|
||||
|
||||
@@ -32,7 +32,7 @@ class Xrpl(ConanFile):
|
||||
"libarchive/3.8.1",
|
||||
"nudb/2.0.9",
|
||||
"openssl/3.5.5",
|
||||
"secp256k1/0.7.0",
|
||||
"secp256k1/0.7.1",
|
||||
"soci/4.0.3",
|
||||
"zlib/1.3.1",
|
||||
]
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
// Add new amendments to the top of this list.
|
||||
// Keep it sorted in reverse chronological order.
|
||||
|
||||
XRPL_FEATURE(DefragDirectories, Supported::no, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (ExpiredNFTokenOfferRemoval, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FIX (BatchInnerSigs, Supported::yes, VoteBehavior::DefaultNo)
|
||||
XRPL_FEATURE(LendingProtocol, Supported::yes, VoteBehavior::DefaultNo)
|
||||
|
||||
@@ -111,6 +111,7 @@ JSS(accounts); // in: LedgerEntry, Subscribe,
|
||||
// handlers/Ledger, Unsubscribe
|
||||
JSS(accounts_proposed); // in: Subscribe, Unsubscribe
|
||||
JSS(action);
|
||||
JSS(active); // out: OverlayImpl
|
||||
JSS(acquiring); // out: LedgerRequest
|
||||
JSS(address); // out: PeerImp
|
||||
JSS(affected); // out: AcceptedLedgerTx
|
||||
@@ -298,6 +299,7 @@ JSS(id); // websocket.
|
||||
JSS(ident); // in: AccountCurrencies, AccountInfo,
|
||||
// OwnerInfo
|
||||
JSS(ignore_default); // in: AccountLines
|
||||
JSS(in); // out: OverlayImpl
|
||||
JSS(inLedger); // out: tx/Transaction
|
||||
JSS(inbound); // out: PeerImp
|
||||
JSS(index); // in: LedgerEntry
|
||||
@@ -459,6 +461,7 @@ JSS(open_ledger_fee); // out: TxQ
|
||||
JSS(open_ledger_level); // out: TxQ
|
||||
JSS(oracles); // in: get_aggregate_price
|
||||
JSS(oracle_document_id); // in: get_aggregate_price
|
||||
JSS(out); // out: OverlayImpl
|
||||
JSS(owner); // in: LedgerEntry, out: NetworkOPs
|
||||
JSS(owner_funds); // in/out: Ledger, NetworkOPs, AcceptedLedgerTx
|
||||
JSS(page_index);
|
||||
|
||||
@@ -10,14 +10,6 @@ namespace xrpl {
|
||||
|
||||
namespace directory {
|
||||
|
||||
struct Gap
|
||||
{
|
||||
uint64_t const page;
|
||||
SLE::pointer node;
|
||||
uint64_t const nextPage;
|
||||
SLE::pointer next;
|
||||
};
|
||||
|
||||
std::uint64_t
|
||||
createRoot(
|
||||
ApplyView& view,
|
||||
@@ -119,9 +111,7 @@ insertPage(
|
||||
if (page == 0)
|
||||
return std::nullopt;
|
||||
if (!view.rules().enabled(fixDirectoryLimit) && page >= dirNodeMaxPages) // Old pages limit
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// We are about to create a new node; we'll link it to
|
||||
// the chain first:
|
||||
@@ -143,8 +133,12 @@ insertPage(
|
||||
// it's the default.
|
||||
if (page != 1)
|
||||
node->setFieldU64(sfIndexPrevious, page - 1);
|
||||
XRPL_ASSERT_PARTS(!nextPage, "xrpl::directory::insertPage", "nextPage has default value");
|
||||
/* Reserved for future use when directory pages may be inserted in
|
||||
* between two other pages instead of only at the end of the chain.
|
||||
if (nextPage)
|
||||
node->setFieldU64(sfIndexNext, nextPage);
|
||||
*/
|
||||
describe(node);
|
||||
view.insert(node);
|
||||
|
||||
@@ -160,7 +154,7 @@ ApplyView::dirAdd(
|
||||
uint256 const& key,
|
||||
std::function<void(std::shared_ptr<SLE> const&)> const& describe)
|
||||
{
|
||||
auto const root = peek(directory);
|
||||
auto root = peek(directory);
|
||||
|
||||
if (!root)
|
||||
{
|
||||
@@ -170,42 +164,6 @@ ApplyView::dirAdd(
|
||||
|
||||
auto [page, node, indexes] = directory::findPreviousPage(*this, directory, root);
|
||||
|
||||
if (rules().enabled(featureDefragDirectories))
|
||||
{
|
||||
// If there are more nodes than just the root, and there's no space in
|
||||
// the last one, walk backwards to find one with space, or to find one
|
||||
// missing.
|
||||
std::optional<directory::Gap> gapPages;
|
||||
while (page && indexes.size() >= dirNodeMaxEntries)
|
||||
{
|
||||
// Find a page with space, or a gap in pages.
|
||||
auto [prevPage, prevNode, prevIndexes] = directory::findPreviousPage(*this, directory, node);
|
||||
if (!gapPages && prevPage != page - 1)
|
||||
gapPages.emplace(prevPage, prevNode, page, node);
|
||||
page = prevPage;
|
||||
node = prevNode;
|
||||
indexes = prevIndexes;
|
||||
}
|
||||
// We looped through all the pages back to the root.
|
||||
if (!page)
|
||||
{
|
||||
// If we found a gap, use it.
|
||||
if (gapPages)
|
||||
{
|
||||
return directory::insertPage(
|
||||
*this,
|
||||
gapPages->page,
|
||||
gapPages->node,
|
||||
gapPages->nextPage,
|
||||
gapPages->next,
|
||||
key,
|
||||
directory,
|
||||
describe);
|
||||
}
|
||||
std::tie(page, node, indexes) = directory::findPreviousPage(*this, directory, root);
|
||||
}
|
||||
}
|
||||
|
||||
// If there's space, we use it:
|
||||
if (indexes.size() < dirNodeMaxEntries)
|
||||
{
|
||||
|
||||
@@ -592,20 +592,18 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
Number const overpaymentAmount{50};
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset, loanScale, overpaymentAmount, TenthBips32(0), TenthBips32(0), managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -636,20 +634,20 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.interestDue - newState.interestDue == 0,
|
||||
loanProperties.loanState.interestDue - newState.interestDue == 0,
|
||||
" interest change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.interestDue - newState.interestDue));
|
||||
to_string(loanProperties.loanState.interestDue - newState.interestDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
}
|
||||
|
||||
@@ -672,7 +670,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -680,17 +678,15 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(10'000), // 10% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -721,21 +717,21 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
// With no Loan interest, interest outstanding should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.interestDue - newState.interestDue == 0,
|
||||
loanProperties.loanState.interestDue - newState.interestDue == 0,
|
||||
" interest change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.interestDue - newState.interestDue));
|
||||
to_string(loanProperties.loanState.interestDue - newState.interestDue));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
}
|
||||
|
||||
@@ -758,7 +754,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -766,17 +762,15 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -812,22 +806,22 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange == newState.interestDue - loanProperites.loanState.interestDue,
|
||||
actualPaymentParts.valueChange == newState.interestDue - loanProperties.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -849,7 +843,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -857,17 +851,15 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -904,26 +896,26 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// The change in interest is equal to the value change sans the
|
||||
// overpayment interest
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(
|
||||
newState.interestDue - loanProperites.loanState.interestDue + actualPaymentParts.interestPaid) +
|
||||
newState.interestDue - loanProperties.loanState.interestDue + actualPaymentParts.interestPaid) +
|
||||
", got " + to_string(actualPaymentParts.valueChange));
|
||||
|
||||
// With no Loan management fee, management fee due should not change
|
||||
BEAST_EXPECTS(
|
||||
loanProperites.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
loanProperties.loanState.managementFeeDue - newState.managementFeeDue == 0,
|
||||
" management fee change mismatch: expected 0, got " +
|
||||
to_string(loanProperites.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
to_string(loanProperties.loanState.managementFeeDue - newState.managementFeeDue));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -947,7 +939,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -955,17 +947,15 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(0), // 0% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -1004,23 +994,23 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
// =========== VALIDATE STATE CHANGES ===========
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// Note that the management fee value change is not captured, as this
|
||||
// value is not needed to correctly update the Vault state.
|
||||
BEAST_EXPECTS(
|
||||
(newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-20592, -5}),
|
||||
(newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-20592, -5}),
|
||||
" management fee change mismatch: expected " + to_string(Number{-20592, -5}) + ", got " +
|
||||
to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue));
|
||||
to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid));
|
||||
}
|
||||
|
||||
@@ -1043,7 +1033,7 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
std::uint32_t const paymentsRemaining = 10;
|
||||
auto const periodicRate = loanPeriodicRate(loanInterestRate, paymentInterval);
|
||||
|
||||
ExtendedPaymentComponents const overpaymentComponents = computeOverpaymentComponents(
|
||||
auto const overpaymentComponents = computeOverpaymentComponents(
|
||||
asset,
|
||||
loanScale,
|
||||
Number{50, 0},
|
||||
@@ -1051,17 +1041,15 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
TenthBips32(10'000), // 10% overpayment fee
|
||||
managementFeeRate);
|
||||
|
||||
auto const loanProperites = computeLoanProperties(
|
||||
auto const loanProperties = computeLoanProperties(
|
||||
asset, loanPrincipal, loanInterestRate, paymentInterval, paymentsRemaining, managementFeeRate, loanScale);
|
||||
|
||||
Number const periodicPayment = loanProperites.periodicPayment;
|
||||
|
||||
auto const ret = tryOverpayment(
|
||||
asset,
|
||||
loanScale,
|
||||
overpaymentComponents,
|
||||
loanProperites.loanState,
|
||||
periodicPayment,
|
||||
loanProperties.loanState,
|
||||
loanProperties.periodicPayment,
|
||||
periodicRate,
|
||||
paymentsRemaining,
|
||||
managementFeeRate,
|
||||
@@ -1101,23 +1089,23 @@ class LendingHelpers_test : public beast::unit_test::suite
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.principalPaid ==
|
||||
loanProperites.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
loanProperties.loanState.principalOutstanding - newState.principalOutstanding,
|
||||
" principalPaid mismatch: expected " +
|
||||
to_string(loanProperites.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(loanProperties.loanState.principalOutstanding - newState.principalOutstanding) + ", got " +
|
||||
to_string(actualPaymentParts.principalPaid));
|
||||
|
||||
// Note that the management fee value change is not captured, as this
|
||||
// value is not needed to correctly update the Vault state.
|
||||
BEAST_EXPECTS(
|
||||
(newState.managementFeeDue - loanProperites.loanState.managementFeeDue == Number{-18304, -5}),
|
||||
(newState.managementFeeDue - loanProperties.loanState.managementFeeDue == Number{-18304, -5}),
|
||||
" management fee change mismatch: expected " + to_string(Number{-18304, -5}) + ", got " +
|
||||
to_string(newState.managementFeeDue - loanProperites.loanState.managementFeeDue));
|
||||
to_string(newState.managementFeeDue - loanProperties.loanState.managementFeeDue));
|
||||
|
||||
BEAST_EXPECTS(
|
||||
actualPaymentParts.valueChange - actualPaymentParts.interestPaid ==
|
||||
newState.interestDue - loanProperites.loanState.interestDue,
|
||||
newState.interestDue - loanProperties.loanState.interestDue,
|
||||
" valueChange mismatch: expected " +
|
||||
to_string(newState.interestDue - loanProperites.loanState.interestDue) + ", got " +
|
||||
to_string(newState.interestDue - loanProperties.loanState.interestDue) + ", got " +
|
||||
to_string(actualPaymentParts.valueChange - actualPaymentParts.interestPaid));
|
||||
}
|
||||
|
||||
|
||||
@@ -827,8 +827,13 @@ public:
|
||||
|
||||
// applyManifest should accept new manifests with
|
||||
// higher sequence numbers
|
||||
auto const seq0 = cache.sequence();
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::accepted);
|
||||
BEAST_EXPECT(cache.sequence() > seq0);
|
||||
|
||||
auto const seq1 = cache.sequence();
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a0)) == ManifestDisposition::stale);
|
||||
BEAST_EXPECT(cache.sequence() == seq1);
|
||||
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::accepted);
|
||||
BEAST_EXPECT(cache.applyManifest(clone(s_a1)) == ManifestDisposition::stale);
|
||||
|
||||
@@ -459,6 +459,10 @@ ManifestCache::applyManifest(Manifest m)
|
||||
|
||||
auto masterKey = m.masterKey;
|
||||
map_.emplace(std::move(masterKey), std::move(m));
|
||||
|
||||
// Something has changed. Keep track of it.
|
||||
seq_++;
|
||||
|
||||
return ManifestDisposition::accepted;
|
||||
}
|
||||
|
||||
|
||||
@@ -630,12 +630,12 @@ OverlayImpl::getOverlayInfo()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
Json::Value jv;
|
||||
auto& av = jv["active"] = Json::Value(Json::arrayValue);
|
||||
auto& av = jv[jss::active] = Json::Value(Json::arrayValue);
|
||||
|
||||
for_each([&](std::shared_ptr<PeerImp>&& sp) {
|
||||
auto& pv = av.append(Json::Value(Json::objectValue));
|
||||
pv[jss::public_key] = base64_encode(sp->getNodePublic().data(), sp->getNodePublic().size());
|
||||
pv[jss::type] = sp->slot()->inbound() ? "in" : "out";
|
||||
pv[jss::type] = sp->slot()->inbound() ? jss::in : jss::out;
|
||||
pv[jss::uptime] = static_cast<std::uint32_t>(duration_cast<seconds>(sp->uptime()).count());
|
||||
if (sp->crawl())
|
||||
{
|
||||
@@ -647,7 +647,7 @@ OverlayImpl::getOverlayInfo()
|
||||
}
|
||||
else
|
||||
{
|
||||
pv[jss::port] = std::to_string(sp->getRemoteAddress().port());
|
||||
pv[jss::port] = sp->getRemoteAddress().port();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user