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
2023-09-18 11:51:54 +03:00
committed by Bastian Köcher
parent 655a5055cc
commit 4cd9e2fe79
10 changed files with 716 additions and 29 deletions
@@ -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