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:
@ -2167,9 +2167,9 @@ mod tests {
|
||||
$(
|
||||
// Since data moves for each tried method, need to recalculate everything
|
||||
let db_tx_count =
|
||||
database_blocks.iter().map(|b| b.body().transactions.len()).sum::<usize>() as u64;
|
||||
database_blocks.iter().map(|b| b.transaction_count()).sum::<usize>() as u64;
|
||||
let in_mem_tx_count =
|
||||
in_memory_blocks.iter().map(|b| b.body().transactions.len()).sum::<usize>() as u64;
|
||||
in_memory_blocks.iter().map(|b| b.transaction_count()).sum::<usize>() as u64;
|
||||
|
||||
let db_range = 0..=(db_tx_count - 1);
|
||||
let in_mem_range = db_tx_count..=(in_mem_tx_count + db_range.end());
|
||||
@ -2410,7 +2410,7 @@ mod tests {
|
||||
.iter()
|
||||
.chain(in_memory_blocks.iter())
|
||||
.take_while(|b| b.number < block.number)
|
||||
.map(|b| b.body().transactions.len())
|
||||
.map(|b| b.transaction_count())
|
||||
.sum::<usize>() as u64
|
||||
};
|
||||
|
||||
@ -2431,7 +2431,7 @@ mod tests {
|
||||
.iter()
|
||||
.chain(in_memory_blocks.iter())
|
||||
.take_while(|b| b.number < block.number)
|
||||
.map(|b| b.body().transactions.len())
|
||||
.map(|b| b.transaction_count())
|
||||
.sum::<usize>() as u64
|
||||
};
|
||||
|
||||
@ -2527,7 +2527,7 @@ mod tests {
|
||||
block.number,
|
||||
Some(StoredBlockBodyIndices {
|
||||
first_tx_num: tx_num,
|
||||
tx_count: block.body().transactions.len() as u64
|
||||
tx_count: block.transaction_count() as u64
|
||||
})
|
||||
),
|
||||
u64::MAX
|
||||
@ -2725,7 +2725,7 @@ mod tests {
|
||||
canonical_in_memory_state: CanonicalInMemoryState,
|
||||
_factory: ProviderFactory<MockNodeTypesWithDB>| {
|
||||
if let Some(tx) = canonical_in_memory_state.transaction_by_hash(hash) {
|
||||
return Ok::<_, ProviderError>(Some(tx))
|
||||
return Ok::<_, ProviderError>(Some(tx));
|
||||
}
|
||||
panic!("should not be in database");
|
||||
// _factory.transaction_by_hash(hash)
|
||||
|
||||
Reference in New Issue
Block a user