Skip to content

Commit

Permalink
Make upper bound of ChainReaderBlockStreamer inclusive
Browse files Browse the repository at this point in the history
Before its upper bound was exclusive this was fine when others
subsystems were also exclusive but this changed with the fixes
for input-output-hk#1785: now the `until` parameter the last block to include in the
signature instead of being the block were we should stop polling.
  • Loading branch information
Alenar authored and locallycompact committed Sep 27, 2024
1 parent 2678530 commit 9f8c3bb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl ChainReaderBlockStreamer {
let mut chain_reader = self.chain_reader.try_lock()?;
match chain_reader.get_next_chain_block().await? {
Some(ChainBlockNextAction::RollForward { parsed_block }) => {
if parsed_block.block_number >= self.until {
if parsed_block.block_number > self.until {
trace!(
self.logger,
"ChainReaderBlockStreamer received a RollForward above threshold block number ({})",
Expand Down Expand Up @@ -165,7 +165,7 @@ mod tests {
const MAX_ROLL_FORWARDS_PER_POLL: usize = 100;

#[tokio::test]
async fn test_parse_expected_nothing_above_block_number_threshold() {
async fn test_parse_expected_nothing_strictly_above_block_number_threshold() {
let until_block_number = 10;
let chain_reader = Arc::new(Mutex::new(FakeChainReader::new(vec![
ChainBlockNextAction::RollForward {
Expand All @@ -190,7 +190,7 @@ mod tests {
let mut block_streamer = ChainReaderBlockStreamer::try_new(
chain_reader.clone(),
None,
until_block_number,
until_block_number - 1,
MAX_ROLL_FORWARDS_PER_POLL,
TestLogger::stdout(),
)
Expand All @@ -203,7 +203,7 @@ mod tests {
let mut block_streamer = ChainReaderBlockStreamer::try_new(
chain_reader,
None,
until_block_number + 1,
until_block_number,
MAX_ROLL_FORWARDS_PER_POLL,
TestLogger::stdout(),
)
Expand Down

0 comments on commit 9f8c3bb

Please sign in to comment.