mirror of
https://github.com/XRPLF/rippled.git
synced 2026-03-20 19:52:32 +00:00
Compare commits
4 Commits
bthomee/no
...
mvadari/or
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67daf923c7 | ||
|
|
dd008b98a4 | ||
|
|
ead4e49dd2 | ||
|
|
3758152499 |
@@ -92,7 +92,7 @@ SetOracle::preclaim(PreclaimContext const& ctx)
|
||||
return !v || *v == (*sle)[field];
|
||||
};
|
||||
|
||||
std::uint32_t adjustReserve = 0;
|
||||
std::int8_t adjustReserve = 0;
|
||||
if (sle)
|
||||
{
|
||||
// update
|
||||
|
||||
@@ -218,6 +218,12 @@ doGetAggregatePrice(RPC::JsonContext& context)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get the ledger
|
||||
std::shared_ptr<ReadView const> ledger;
|
||||
result = RPC::lookupLedger(ledger, context);
|
||||
if (!ledger)
|
||||
return result; // LCOV_EXCL_LINE
|
||||
|
||||
// Collect the dataset into bimap keyed by lastUpdateTime and
|
||||
// STAmount (Number is int64 and price is uint64)
|
||||
Prices prices;
|
||||
@@ -238,11 +244,6 @@ doGetAggregatePrice(RPC::JsonContext& context)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<ReadView const> ledger;
|
||||
result = RPC::lookupLedger(ledger, context);
|
||||
if (!ledger)
|
||||
return result; // LCOV_EXCL_LINE
|
||||
|
||||
auto const sle = ledger->read(keylet::oracle(*account, *documentID));
|
||||
iteratePriceData(context, sle, [&](STObject const& node) {
|
||||
auto const& series = node.getFieldArray(sfPriceDataSeries);
|
||||
@@ -284,8 +285,8 @@ doGetAggregatePrice(RPC::JsonContext& context)
|
||||
if (auto const threshold = std::get<std::uint32_t>(timeThreshold))
|
||||
{
|
||||
// threshold defines an acceptable range {max,min} of lastUpdateTime as
|
||||
// {latestTime, latestTime - threshold}, the prices with lastUpdateTime
|
||||
// greater than (latestTime - threshold) are erased.
|
||||
// {latestTime, latestTime - threshold}. Prices with lastUpdateTime
|
||||
// less than (latestTime - threshold) are erased (outdated prices).
|
||||
auto const oldestTime = prices.left.rbegin()->first;
|
||||
auto const upperBound = latestTime > threshold ? (latestTime - threshold) : oldestTime;
|
||||
if (upperBound > oldestTime)
|
||||
|
||||
Reference in New Issue
Block a user