Skip to content

Commit 14a60f8

Browse files
committed
PR review: style & naming adjusments
1 parent 5aab1d5 commit 14a60f8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

mithril-common/src/cardano_block_scanner/immutable_block_streamer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ use crate::StdResult;
1313

1414
/// [Block streamer][BlockStreamer] that streams blocks immutable files per immutable files
1515
pub struct ImmutableBlockStreamer {
16-
remaining_immutables: VecDeque<ImmutableFile>,
16+
remaining_immutable_files: VecDeque<ImmutableFile>,
1717
allow_unparsable_block: bool,
1818
logger: Logger,
1919
}
2020

2121
#[async_trait]
2222
impl BlockStreamer for ImmutableBlockStreamer {
2323
async fn poll_next(&mut self) -> StdResult<Option<Vec<ScannedBlock>>> {
24-
match &self.remaining_immutables.pop_front() {
24+
match &self.remaining_immutable_files.pop_front() {
2525
Some(immutable_file) => {
2626
debug!(
2727
self.logger,
@@ -52,7 +52,7 @@ impl ImmutableBlockStreamer {
5252
logger: Logger,
5353
) -> Self {
5454
Self {
55-
remaining_immutables: VecDeque::from(immutables_chunk_to_stream),
55+
remaining_immutable_files: VecDeque::from(immutables_chunk_to_stream),
5656
allow_unparsable_block,
5757
logger,
5858
}
@@ -148,19 +148,19 @@ mod tests {
148148

149149
let immutable_blocks = streamer.poll_next().await.unwrap();
150150
assert_eq!(
151-
immutable_blocks.map(|b| b.into_iter().map(|b| b.transaction_len()).sum()),
151+
immutable_blocks.map(|b| b.into_iter().map(|b| b.transactions_len()).sum()),
152152
Some(immutable_files[0].1)
153153
);
154154

155155
let immutable_blocks = streamer.poll_next().await.unwrap();
156156
assert_eq!(
157-
immutable_blocks.map(|b| b.into_iter().map(|b| b.transaction_len()).sum()),
157+
immutable_blocks.map(|b| b.into_iter().map(|b| b.transactions_len()).sum()),
158158
Some(immutable_files[1].1)
159159
);
160160

161161
let immutable_blocks = streamer.poll_next().await.unwrap();
162162
assert_eq!(
163-
immutable_blocks.map(|b| b.into_iter().map(|b| b.transaction_len()).sum()),
163+
immutable_blocks.map(|b| b.into_iter().map(|b| b.transactions_len()).sum()),
164164
Some(immutable_files[2].1)
165165
);
166166

mithril-common/src/cardano_block_scanner/scanned_block.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ pub struct ScannedBlock {
1313
pub block_number: BlockNumber,
1414
/// Slot number of the block
1515
pub slot_number: SlotNumber,
16-
/// Number of the immutable that own the block
16+
/// Number of the immutable file that own the block
1717
pub immutable_file_number: ImmutableFileNumber,
1818
/// Hashes of the transactions in the block
19-
pub transactions: Vec<TransactionHash>,
19+
pub transactions_hashes: Vec<TransactionHash>,
2020
}
2121

2222
impl ScannedBlock {
@@ -33,7 +33,7 @@ impl ScannedBlock {
3333
block_number,
3434
slot_number,
3535
immutable_file_number,
36-
transactions: transaction_hashes.into_iter().map(|h| h.into()).collect(),
36+
transactions_hashes: transaction_hashes.into_iter().map(|h| h.into()).collect(),
3737
}
3838
}
3939

@@ -56,15 +56,15 @@ impl ScannedBlock {
5656
}
5757

5858
/// Number of transactions in the block
59-
pub fn transaction_len(&self) -> usize {
60-
self.transactions.len()
59+
pub fn transactions_len(&self) -> usize {
60+
self.transactions_hashes.len()
6161
}
6262

6363
/// Convert the scanned block into a list of Cardano transactions.
6464
///
6565
/// Consume the block.
6666
pub fn into_transactions(self) -> Vec<CardanoTransaction> {
67-
self.transactions
67+
self.transactions_hashes
6868
.into_iter()
6969
.map(|transaction_hash| {
7070
CardanoTransaction::new(

0 commit comments

Comments
 (0)