Skip to content

Commit

Permalink
fix oracle interval index 2
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Dec 17, 2024
1 parent de33a9b commit 583c635
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ain-ocean/src/indexer/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,14 @@ pub fn index_interval_mapper(
.next()
.transpose()?;

if previous.is_none() || block.median_time - aggregated.block.median_time > interval as i64 {
if previous.is_none() {
return start_new_bucket(services, block, token, currency, aggregated, interval);
};

if let Some(previous) = previous {
if block.median_time - previous.1.block.median_time > interval as i64 {
return start_new_bucket(services, block, token, currency, aggregated, interval);
};
forward_aggregate(services, previous, aggregated)?;
};

Expand Down

0 comments on commit 583c635

Please sign in to comment.