reinstate reject error variant

This commit is contained in:
Jane Lusby 2020-05-27 10:48:40 -07:00 committed by Deirdre Connolly
parent 4dc307f2f3
commit 8276bed400
1 changed files with 9 additions and 0 deletions

View File

@ -11,6 +11,7 @@ pub struct SharedPeerError(#[from] Arc<PeerError>);
/// An error related to peer connection handling.
#[derive(Error, Debug)]
#[allow(dead_code)]
pub enum PeerError {
/// The remote peer closed the connection.
#[error("Peer closed connection")]
@ -37,6 +38,14 @@ pub enum PeerError {
/// disconnect from upon receipt.
#[error("Remote peer sent an unsupported message type.")]
UnsupportedMessage,
/// We got a `Reject` message. This does not necessarily mean that
/// the peer connection is in a bad state, but for the time being
/// we are considering it a PeerError.
// TODO: Create a different error type (more at the application
// level than network/connection level) that will include the
// appropriate error when a `Reject` message is received.
#[error("Received a Reject message")]
Rejected,
/// The remote peer responded with a block we didn't ask for.
#[error("Remote peer responded with a block we didn't ask for.")]
WrongBlock,