Skip to main content

bark/daemon/tip_watcher/
source.rs

1//! Source of blockchain tip.
2
3use std::future::Future;
4
5use bark_runtime::{MaybeSend, MaybeSync};
6use bitcoin_ext::BlockRef;
7
8/// A backend the tip watcher can fetch the current chain tip from.
9///
10/// Implementors can use a plain `async fn tip_ref`. The [MaybeSend]
11/// bounds require [Send] futures on native platforms only; on WASM the
12/// runtime is single-threaded and HTTP client futures aren't [Send].
13pub trait TipSource: MaybeSend + MaybeSync {
14	fn tip_ref(&self) -> impl Future<Output = anyhow::Result<BlockRef>> + MaybeSend;
15}