Skip to content

Commit 77181bd

Browse files
committed
ref: remove to_live
1 parent 4b55342 commit 77181bd

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/event_scanner/modes/latest.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ pub struct LatestScannerBuilder {
3333
to_block: BlockNumberOrTag,
3434
// Defaults to 0
3535
block_confirmations: u64,
36-
// Defaults to false
37-
switch_to_live: bool,
3836
}
3937

4038
pub struct LatestEventScanner<N: Network> {
@@ -57,7 +55,6 @@ impl LatestScannerBuilder {
5755
from_block: BlockNumberOrTag::Latest,
5856
to_block: BlockNumberOrTag::Earliest,
5957
block_confirmations: DEFAULT_BLOCK_CONFIRMATIONS,
60-
switch_to_live: false,
6158
}
6259
}
6360

@@ -85,12 +82,6 @@ impl LatestScannerBuilder {
8582
self
8683
}
8784

88-
#[must_use]
89-
pub fn then_live(mut self) -> Self {
90-
self.switch_to_live = true;
91-
self
92-
}
93-
9485
/// Connects to the provider via WebSocket
9586
///
9687
/// # Errors
@@ -171,7 +162,6 @@ mod tests {
171162
assert!(matches!(config.from_block, BlockNumberOrTag::Latest));
172163
assert!(matches!(config.to_block, BlockNumberOrTag::Earliest));
173164
assert_eq!(config.block_confirmations, DEFAULT_BLOCK_CONFIRMATIONS);
174-
assert!(!config.switch_to_live);
175165
}
176166

177167
#[test]
@@ -181,14 +171,12 @@ mod tests {
181171
.from_block(100)
182172
.to_block(200)
183173
.block_confirmations(10)
184-
.then_live()
185174
.max_block_range(50);
186175

187176
assert_eq!(config.count, 5);
188177
assert!(matches!(config.from_block, BlockNumberOrTag::Number(100)));
189178
assert!(matches!(config.to_block, BlockNumberOrTag::Number(200)));
190179
assert_eq!(config.block_confirmations, 10);
191-
assert!(config.switch_to_live);
192180
assert_eq!(config.base.block_range_scanner.max_block_range, 50);
193181
}
194182

@@ -199,15 +187,13 @@ mod tests {
199187
.block_confirmations(5)
200188
.count(3)
201189
.from_block(BlockNumberOrTag::Number(50))
202-
.to_block(BlockNumberOrTag::Number(150))
203-
.then_live();
190+
.to_block(BlockNumberOrTag::Number(150));
204191

205192
assert_eq!(config.base.block_range_scanner.max_block_range, 25);
206193
assert_eq!(config.block_confirmations, 5);
207194
assert_eq!(config.count, 3);
208195
assert!(matches!(config.from_block, BlockNumberOrTag::Number(50)));
209196
assert!(matches!(config.to_block, BlockNumberOrTag::Number(150)));
210-
assert!(config.switch_to_live);
211197
}
212198

213199
#[test]
@@ -222,15 +208,5 @@ mod tests {
222208
assert!(matches!(config.to_block, BlockNumberOrTag::Latest));
223209
assert_eq!(config.count, 10);
224210
assert_eq!(config.block_confirmations, 20);
225-
assert!(!config.switch_to_live);
226-
}
227-
228-
#[test]
229-
fn test_latest_scanner_then_live_method() {
230-
let config = LatestScannerBuilder::new().then_live();
231-
assert!(config.switch_to_live);
232-
233-
let config_without_live = LatestScannerBuilder::new();
234-
assert!(!config_without_live.switch_to_live);
235211
}
236212
}

0 commit comments

Comments
 (0)