Skip to content

Commit

Permalink
fix get_latest_aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Dec 10, 2024
1 parent 7421bf9 commit 0d0f327
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/ain-ocean/src/api/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,11 @@ fn get_latest_aggregation(
.script_aggregation
.by_id
.list(Some((hid, [0xffu8; 4])), SortOrder::Descending)?
.take(1)
.take_while(|item| match item {
Ok(((v, _), _)) => v == &hid,
_ => true,
})
.map(|item| {
let (_, v) = item?;
let res = v.into();
Ok(res)
})
.collect::<Result<Vec<_>>>()?;
.next()
.transpose()?
.map(|(_, v)| v.into());

Ok(latest.first().cloned())
Ok(latest)
}

#[ocean_endpoint]
Expand Down

0 comments on commit 0d0f327

Please sign in to comment.