zebrad: rename sync::Error alias to BoxError.

This commit is contained in:
Henry de Valence 2020-09-09 12:24:55 -07:00
parent a141c336ab
commit b636660d6a
1 changed files with 9 additions and 9 deletions

View File

@ -97,6 +97,9 @@ const TIPS_RETRY_TIMEOUT: Duration = Duration::from_secs(60);
/// networks, and on testnet, which has a small number of slow peers. /// networks, and on testnet, which has a small number of slow peers.
const SYNC_RESTART_TIMEOUT: Duration = Duration::from_secs(100); const SYNC_RESTART_TIMEOUT: Duration = Duration::from_secs(100);
type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
type ReportAndHash = (Report, block::Hash);
/// Helps work around defects in the bitcoin protocol by checking whether /// Helps work around defects in the bitcoin protocol by checking whether
/// the returned hashes actually extend a chain tip. /// the returned hashes actually extend a chain tip.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
@ -108,11 +111,11 @@ struct CheckedTip {
#[derive(Debug)] #[derive(Debug)]
pub struct ChainSync<ZN, ZS, ZV> pub struct ChainSync<ZN, ZS, ZV>
where where
ZN: Service<zn::Request, Response = zn::Response, Error = Error> + Send + Clone + 'static, ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + Clone + 'static,
ZN::Future: Send, ZN::Future: Send,
ZS: Service<zs::Request, Response = zs::Response, Error = Error> + Send + Clone + 'static, ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + Clone + 'static,
ZS::Future: Send, ZS::Future: Send,
ZV: Service<Arc<Block>, Response = block::Hash, Error = Error> + Send + Clone + 'static, ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
ZV::Future: Send, ZV::Future: Send,
{ {
/// Used to perform ObtainTips and ExtendTips requests, with no retry logic /// Used to perform ObtainTips and ExtendTips requests, with no retry logic
@ -135,11 +138,11 @@ where
/// diffusion. /// diffusion.
impl<ZN, ZS, ZV> ChainSync<ZN, ZS, ZV> impl<ZN, ZS, ZV> ChainSync<ZN, ZS, ZV>
where where
ZN: Service<zn::Request, Response = zn::Response, Error = Error> + Send + Clone + 'static, ZN: Service<zn::Request, Response = zn::Response, Error = BoxError> + Send + Clone + 'static,
ZN::Future: Send, ZN::Future: Send,
ZS: Service<zs::Request, Response = zs::Response, Error = Error> + Send + Clone + 'static, ZS: Service<zs::Request, Response = zs::Response, Error = BoxError> + Send + Clone + 'static,
ZS::Future: Send, ZS::Future: Send,
ZV: Service<Arc<Block>, Response = block::Hash, Error = Error> + Send + Clone + 'static, ZV: Service<Arc<Block>, Response = block::Hash, Error = BoxError> + Send + Clone + 'static,
ZV::Future: Send, ZV::Future: Send,
{ {
/// Returns a new syncer instance, using: /// Returns a new syncer instance, using:
@ -676,9 +679,6 @@ where
} }
} }
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
type ReportAndHash = (Report, block::Hash);
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;