Add unit tests for the equivocation detection loop (#2571)

* Add unit tests for the equivocation detection loop

* clippy

* use std::future::pending()
This commit is contained in:
Serban Iorga authored and Bastian Köcher committed 2024-04-10 10:28:37 +02:00
1 parent 655a5055cc
commit 4cd9e2fe79
10 files changed
+716 -29

No files matched your search

@@ -32,6 +32,10 @@ impl<P: FinalityPipeline, SC: SourceClientBase<P>> FinalityProofsStream<P, SC> {
Self { stream: None }
}
pub fn from_stream(stream: SC::FinalityProofsStream) -> Self {
Self { stream: Some(Box::pin(stream)) }
}
fn next(&mut self) -> Option<<SC::FinalityProofsStream as Stream>::Item> {
let stream = match &mut self.stream {
Some(stream) => stream,
@@ -131,12 +135,6 @@ mod tests {
use super::*;
use crate::mock::*;
impl<P: FinalityPipeline, SC: SourceClientBase<P>> FinalityProofsStream<P, SC> {
fn from_stream(stream: SC::FinalityProofsStream) -> Self {
Self { stream: Some(Box::pin(stream)) }
}
}
#[test]
fn finality_proofs_buf_fill_works() {
// when stream is currently empty, nothing is changed