Compare commits

..

1 Commits

Author SHA1 Message Date
Mayukha Vadari
be1cc48d84 fix: Assorted Oracle fixes (#6570) 2026-03-22 18:08:18 +00:00
4 changed files with 13 additions and 9 deletions

View File

@@ -12,6 +12,8 @@ namespace xrpl {
Expected<std::vector<SignerEntries::SignerEntry>, NotTEC>
SignerEntries::deserialize(STObject const& obj, beast::Journal journal, std::string_view annotation)
{
std::pair<std::vector<SignerEntry>, NotTEC> s;
if (!obj.isFieldPresent(sfSignerEntries))
{
JLOG(journal.trace()) << "Malformed " << annotation << ": Need signer entry array.";

View File

@@ -674,7 +674,8 @@ Transactor::checkSign(
}
// Look up the account.
auto const idSigner = calcAccountID(PublicKey(makeSlice(pkSigner)));
auto const idSigner =
pkSigner.empty() ? idAccount : calcAccountID(PublicKey(makeSlice(pkSigner)));
auto const sleAccount = view.read(keylet::account(idAccount));
if (!sleAccount)
return terNO_ACCOUNT;

View File

@@ -98,7 +98,7 @@ OracleSet::preclaim(PreclaimContext const& ctx)
return !v || *v == (*sle)[field];
};
std::uint32_t adjustReserve = 0;
std::int8_t adjustReserve = 0;
if (sle)
{
// update

View File

@@ -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)