Skip to content

Commit 9492050

Browse files
committed
Remove get_block_interval_without_block_range_root
As it's supersed by `get_highest_block_range`, this means that we can also remove the whole query behind it.
1 parent ef7f71a commit 9492050

File tree

7 files changed

+1
-248
lines changed

7 files changed

+1
-248
lines changed

internal/mithril-persistence/src/database/query/block_range_root/get_interval_without_block_range.rs

Lines changed: 0 additions & 37 deletions
This file was deleted.

internal/mithril-persistence/src/database/query/block_range_root/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
mod delete_block_range_root;
22
mod get_block_range_root;
3-
mod get_interval_without_block_range;
43
mod insert_block_range;
54

65
pub use delete_block_range_root::*;
76
pub use get_block_range_root::*;
8-
pub use get_interval_without_block_range::*;
97
pub use insert_block_range::*;
108

119
#[cfg(test)]

internal/mithril-persistence/src/database/record/interval_without_block_range_root.rs

Lines changed: 0 additions & 143 deletions
This file was deleted.

internal/mithril-persistence/src/database/record/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
mod block_range_root;
44
mod cardano_transaction;
5-
mod interval_without_block_range_root;
65

76
pub use block_range_root::*;
87
pub use cardano_transaction::*;
9-
pub use interval_without_block_range_root::*;

internal/mithril-persistence/src/database/repository/cardano_transaction_repository.rs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ use mithril_common::StdResult;
1515

1616
use crate::database::query::{
1717
DeleteBlockRangeRootQuery, DeleteCardanoTransactionQuery, GetBlockRangeRootQuery,
18-
GetCardanoTransactionQuery, GetIntervalWithoutBlockRangeRootQuery, InsertBlockRangeRootQuery,
19-
InsertCardanoTransactionQuery,
18+
GetCardanoTransactionQuery, InsertBlockRangeRootQuery, InsertCardanoTransactionQuery,
2019
};
2120
use crate::database::record::{BlockRangeRootRecord, CardanoTransactionRecord};
2221
use crate::sqlite::{ConnectionExtensions, SqliteConnection, SqliteConnectionPool};
@@ -235,22 +234,6 @@ impl CardanoTransactionRepository {
235234
Ok(())
236235
}
237236

238-
/// Get the block interval without block range root if any.
239-
pub async fn get_block_interval_without_block_range_root(
240-
&self,
241-
) -> StdResult<Option<Range<BlockNumber>>> {
242-
let interval = self
243-
.connection_pool
244-
.connection()?
245-
.fetch_first(GetIntervalWithoutBlockRangeRootQuery::new())?
246-
// Should be impossible - the request as written in the query always returns a single row
247-
.unwrap_or_else(|| {
248-
panic!("GetIntervalWithoutBlockRangeRootQuery should always return a single row")
249-
});
250-
251-
interval.to_range()
252-
}
253-
254237
/// Get the block number for a given slot number
255238
pub async fn get_block_number_by_slot_number(
256239
&self,
@@ -761,41 +744,6 @@ mod tests {
761744
}
762745
}
763746

764-
#[tokio::test]
765-
async fn repository_get_block_interval_without_block_range_root() {
766-
let connection = cardano_tx_db_connection().unwrap();
767-
let repository = CardanoTransactionRepository::new(Arc::new(
768-
SqliteConnectionPool::build_from_connection(connection),
769-
));
770-
771-
// The last block range give the lower bound
772-
let last_block_range = BlockRange::from_block_number(0);
773-
repository
774-
.create_block_range_roots(vec![(
775-
last_block_range.clone(),
776-
MKTreeNode::from_hex("AAAA").unwrap(),
777-
)])
778-
.await
779-
.unwrap();
780-
781-
// The last transaction block number give the upper bound
782-
let last_transaction_block_number = BlockRange::LENGTH * 4;
783-
repository
784-
.create_transaction("tx-1", last_transaction_block_number, 50, "block-1", 99)
785-
.await
786-
.unwrap();
787-
788-
let interval = repository
789-
.get_block_interval_without_block_range_root()
790-
.await
791-
.unwrap();
792-
793-
assert_eq!(
794-
Some(last_block_range.end..(last_transaction_block_number + 1)),
795-
interval
796-
);
797-
}
798-
799747
#[tokio::test]
800748
async fn repository_get_transactions_by_block_ranges() {
801749
let connection = cardano_tx_db_connection().unwrap();

mithril-aggregator/src/database/repository/cardano_transaction_repository.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ impl TransactionStore for CardanoTransactionRepository {
2626
self.store_transactions(transactions).await
2727
}
2828

29-
async fn get_block_interval_without_block_range_root(
30-
&self,
31-
) -> StdResult<Option<Range<BlockNumber>>> {
32-
self.get_block_interval_without_block_range_root().await
33-
}
34-
3529
async fn get_transactions_in_range(
3630
&self,
3731
range: Range<BlockNumber>,

mithril-aggregator/src/services/cardano_transactions_importer.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ pub trait TransactionStore: Send + Sync {
2828
/// Store list of transactions
2929
async fn store_transactions(&self, transactions: Vec<CardanoTransaction>) -> StdResult<()>;
3030

31-
/// Get the interval of blocks whose merkle root has yet to be computed
32-
async fn get_block_interval_without_block_range_root(
33-
&self,
34-
) -> StdResult<Option<Range<BlockNumber>>>;
35-
3631
/// Get transactions in an interval of blocks
3732
async fn get_transactions_in_range(
3833
&self,

0 commit comments

Comments
 (0)