Skip to content

Commit

Permalink
Fix miscounting blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
WuBruno committed Oct 31, 2023
1 parent 82520c8 commit 353be67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion products/pdt/pdtlisten/src/importer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BatchedImporter {
if block.block < range.start {
self.range = Some(block.block..range.end)
} else if block.block > range.end {
self.range = Some(range.start..block.block)
self.range = Some(range.start..block.block + 1) // range end not inclusive
}
} else {
self.range = Some(block.block..(block.block + 1))
Expand Down
6 changes: 5 additions & 1 deletion products/pdt/pdtlisten/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ async fn get_block(
let mut blocks: Vec<(Block<Transaction>, Vec<ZILTransactionBody>)> = Vec::new();
for _block_number in last_seen_block_number_unwrap.as_u64() + 1..=block_number.as_u64() {
let block = get_block_by_number(_block_number.into(), provider).await?;
let txn_bodies = get_zil_transaction_bodies_from_block(block_number, provider).await?;
let txn_bodies = if block.transactions.is_empty() {
Vec::default()
} else {
get_zil_transaction_bodies_from_block(block_number, provider).await?
};
blocks.push((block, txn_bodies));
}

Expand Down

0 comments on commit 353be67

Please sign in to comment.