Skip to content

Commit 5ea2904

Browse files
committed
Make upper bound of ChainReaderBlockStreamer inclusive
Before its upper bound was exclusive this was fine when others subsystems were also exclusive but this changed with the fixes for #1785: now the `until` parameter the last block to include in the signature instead of being the block were we should stop polling.
1 parent 4bc87f0 commit 5ea2904

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mithril-common/src/cardano_block_scanner/chain_reader_block_streamer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl ChainReaderBlockStreamer {
109109
let mut chain_reader = self.chain_reader.try_lock()?;
110110
match chain_reader.get_next_chain_block().await? {
111111
Some(ChainBlockNextAction::RollForward { parsed_block }) => {
112-
if parsed_block.block_number >= self.until {
112+
if parsed_block.block_number > self.until {
113113
trace!(
114114
self.logger,
115115
"ChainReaderBlockStreamer received a RollForward above threshold block number ({})",
@@ -165,7 +165,7 @@ mod tests {
165165
const MAX_ROLL_FORWARDS_PER_POLL: usize = 100;
166166

167167
#[tokio::test]
168-
async fn test_parse_expected_nothing_above_block_number_threshold() {
168+
async fn test_parse_expected_nothing_strictly_above_block_number_threshold() {
169169
let until_block_number = 10;
170170
let chain_reader = Arc::new(Mutex::new(FakeChainReader::new(vec![
171171
ChainBlockNextAction::RollForward {
@@ -190,7 +190,7 @@ mod tests {
190190
let mut block_streamer = ChainReaderBlockStreamer::try_new(
191191
chain_reader.clone(),
192192
None,
193-
until_block_number,
193+
until_block_number - 1,
194194
MAX_ROLL_FORWARDS_PER_POLL,
195195
TestLogger::stdout(),
196196
)
@@ -203,7 +203,7 @@ mod tests {
203203
let mut block_streamer = ChainReaderBlockStreamer::try_new(
204204
chain_reader,
205205
None,
206-
until_block_number + 1,
206+
until_block_number,
207207
MAX_ROLL_FORWARDS_PER_POLL,
208208
TestLogger::stdout(),
209209
)

0 commit comments

Comments
 (0)