1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use std::io;
use crossbeam_channel as chan;
use thiserror::Error;
use nakamoto_chain as chain;
use nakamoto_common as common;
use nakamoto_p2p as p2p;
use p2p::protocol::Command;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
Handle(#[from] crate::handle::Error),
#[error(transparent)]
Net(#[from] nakamoto_net::error::Error),
#[error(transparent)]
Chain(#[from] common::block::tree::Error),
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
BlockStore(#[from] common::block::store::Error),
#[error(transparent)]
FilterStore(#[from] chain::filter::store::Error),
#[error("error loading peers: {0}")]
PeerStore(io::Error),
#[error("command channel disconnected")]
Channel,
}
impl From<chan::SendError<Command>> for Error {
fn from(_: chan::SendError<Command>) -> Self {
Self::Channel
}
}
impl From<chan::RecvError> for Error {
fn from(_: chan::RecvError) -> Self {
Self::Channel
}
}