mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: Implement "Add BlockBody::transaction_count helper function" (#13660)
This commit is contained in:
@ -592,7 +592,7 @@ mod tests {
|
||||
|
||||
let body = StoredBlockBodyIndices {
|
||||
first_tx_num: 0,
|
||||
tx_count: progress.body().transactions.len() as u64,
|
||||
tx_count: progress.transaction_count() as u64,
|
||||
};
|
||||
|
||||
static_file_producer.set_block_range(0..=progress.number);
|
||||
|
||||
@ -398,7 +398,7 @@ mod tests {
|
||||
|
||||
let body = StoredBlockBodyIndices {
|
||||
first_tx_num,
|
||||
tx_count: progress.body().transactions.len() as u64,
|
||||
tx_count: progress.transaction_count() as u64,
|
||||
};
|
||||
|
||||
first_tx_num = next_tx_num;
|
||||
|
||||
@ -267,7 +267,7 @@ mod tests {
|
||||
let mut receipts = Vec::with_capacity(blocks.len());
|
||||
let mut tx_num = 0u64;
|
||||
for block in &blocks {
|
||||
let mut block_receipts = Vec::with_capacity(block.body().transactions.len());
|
||||
let mut block_receipts = Vec::with_capacity(block.transaction_count());
|
||||
for transaction in &block.body().transactions {
|
||||
block_receipts.push((tx_num, random_receipt(&mut rng, transaction, Some(0))));
|
||||
tx_num += 1;
|
||||
|
||||
@ -477,7 +477,7 @@ mod tests {
|
||||
let expected_progress = seed
|
||||
.iter()
|
||||
.find(|x| {
|
||||
tx_count += x.body().transactions.len();
|
||||
tx_count += x.transaction_count();
|
||||
tx_count as u64 > threshold
|
||||
})
|
||||
.map(|x| x.number)
|
||||
@ -555,7 +555,7 @@ mod tests {
|
||||
tx_number: Some(
|
||||
blocks[..=max_pruned_block as usize]
|
||||
.iter()
|
||||
.map(|block| block.body().transactions.len() as u64)
|
||||
.map(|block| block.transaction_count() as u64)
|
||||
.sum(),
|
||||
),
|
||||
prune_mode: PruneMode::Full,
|
||||
@ -570,9 +570,9 @@ mod tests {
|
||||
EntitiesCheckpoint {
|
||||
processed: blocks[..=max_processed_block]
|
||||
.iter()
|
||||
.map(|block| block.body().transactions.len() as u64)
|
||||
.map(|block| block.transaction_count() as u64)
|
||||
.sum(),
|
||||
total: blocks.iter().map(|block| block.body().transactions.len() as u64).sum()
|
||||
total: blocks.iter().map(|block| block.transaction_count() as u64).sum()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ mod tests {
|
||||
tx_number: Some(
|
||||
blocks[..=max_pruned_block as usize]
|
||||
.iter()
|
||||
.map(|block| block.body().transactions.len() as u64)
|
||||
.map(|block| block.transaction_count() as u64)
|
||||
.sum::<u64>()
|
||||
.sub(1), // `TxNumber` is 0-indexed
|
||||
),
|
||||
@ -419,9 +419,9 @@ mod tests {
|
||||
EntitiesCheckpoint {
|
||||
processed: blocks[..=max_processed_block]
|
||||
.iter()
|
||||
.map(|block| block.body().transactions.len() as u64)
|
||||
.map(|block| block.transaction_count() as u64)
|
||||
.sum(),
|
||||
total: blocks.iter().map(|block| block.body().transactions.len() as u64).sum()
|
||||
total: blocks.iter().map(|block| block.transaction_count() as u64).sum()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ impl TestStageDB {
|
||||
// Insert into body tables.
|
||||
let block_body_indices = StoredBlockBodyIndices {
|
||||
first_tx_num: next_tx_num,
|
||||
tx_count: block.body().transactions.len() as u64,
|
||||
tx_count: block.transaction_count() as u64,
|
||||
};
|
||||
|
||||
if !block.body().transactions.is_empty() {
|
||||
@ -489,7 +489,7 @@ impl StorageKind {
|
||||
|
||||
fn tx_offset(&self) -> u64 {
|
||||
if let Self::Database(offset) = self {
|
||||
return offset.unwrap_or_default()
|
||||
return offset.unwrap_or_default();
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user