Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions substrate/client/network/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ schnellru = "0.2.1"
smallvec = "1.11.0"
thiserror = "1.0"
tokio-stream = "0.1.14"
tokio = { version = "1.32.0", features = ["time", "macros"] }
fork-tree = { path = "../../../utils/fork-tree" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus" }
sc-client-api = { path = "../../api" }
Expand Down
12 changes: 10 additions & 2 deletions substrate/client/network/sync/src/block_announce_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! `BlockAnnounceValidator` is responsible for async validation of block announcements.
//! [`BlockAnnounceValidator`] is responsible for async validation of block announcements.
//! [`Stream`] implemented by [`BlockAnnounceValidator`] never terminates.

use crate::futures_stream::FuturesStream;
use futures::{Future, FutureExt, Stream, StreamExt};
use futures::{stream::FusedStream, Future, FutureExt, Stream, StreamExt};
use libp2p::PeerId;
use log::{debug, error, trace, warn};
use sc_network_common::sync::message::BlockAnnounce;
Expand Down Expand Up @@ -300,6 +301,13 @@ impl<B: BlockT> Stream for BlockAnnounceValidator<B> {
}
}

// As [`BlockAnnounceValidator`] never terminates, we can easily implement [`FusedStream`] for it.
impl<B: BlockT> FusedStream for BlockAnnounceValidator<B> {
fn is_terminated(&self) -> bool {
false
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading