Skip to content

Commit

Permalink
Synchronise most of signer & aggregator ctx repository code
Browse files Browse the repository at this point in the history
  • Loading branch information
Alenar committed May 7, 2024
1 parent da5817d commit 9498a6a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ use std::ops::Range;
use sqlite::Value;

use mithril_common::entities::{BlockNumber, BlockRange, TransactionHash};
#[cfg(test)]
use mithril_persistence::sqlite::GetAllCondition;
use mithril_persistence::sqlite::{
Provider, SourceAlias, SqLiteEntity, SqliteConnection, WhereCondition,
};

#[cfg(test)]
use mithril_persistence::sqlite::GetAllCondition;

use crate::database::record::CardanoTransactionRecord;

/// Simple queries to retrieve [CardanoTransaction] from the sqlite database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ impl BlockRangeRootRetriever for CardanoTransactionRepository {
let provider = GetBlockRangeRootProvider::new(&self.connection);
let filters = provider.get_up_to_block_number_condition(block_number);
let block_range_roots = provider.find(filters)?;
let block_range_roots = block_range_roots
let iterator = block_range_roots
.into_iter()
.map(|record| -> (BlockRange, MKTreeNode) { record.into() })
.collect::<Vec<_>>() // TODO: remove this collect when we should ba able return the iterator directly
.into_iter();

Ok(Box::new(block_range_roots))
Ok(Box::new(iterator))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ impl BlockRangeRootRetriever for CardanoTransactionRepository {
&self,
up_to_beacon: ImmutableFileNumber,
) -> StdResult<Box<dyn Iterator<Item = (BlockRange, MKTreeNode)>>> {
// Get the highest block number for the given immutable number.
// This is a temporary fix that will be removed when the retrieval is based on block number instead of immutable number.
let block_number = self
.get_highest_block_number_for_immutable_number(up_to_beacon)
.await?
Expand Down

0 comments on commit 9498a6a

Please sign in to comment.