From 57c4283220cc6efd2156e411f16272b1a6824dbc Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Thu, 8 Sep 2022 16:58:46 +0200 Subject: [PATCH] Remove unused consensus encoding error variants The error variants `UnexpectedNetworkMagic` and `UnknownNetworkMagic` were not only duplicated but also completely unused. This removes both of them. --- src/consensus/encode.rs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/consensus/encode.rs b/src/consensus/encode.rs index 362a8c54..e2997225 100644 --- a/src/consensus/encode.rs +++ b/src/consensus/encode.rs @@ -43,13 +43,6 @@ pub enum Error { Io(io::Error), /// PSBT-related error Psbt(psbt::Error), - /// Network magic was not expected - UnexpectedNetworkMagic { - /// The expected network magic - expected: u32, - /// The unexpected network magic - actual: u32, - }, /// Tried to allocate an oversized vector OversizedVectorAllocation { /// The capacity requested @@ -66,8 +59,6 @@ pub enum Error { }, /// VarInt was encoded in a non-minimal way NonMinimalVarInt, - /// Network magic was unknown - UnknownNetworkMagic(u32), /// Parsing error ParseFailed(&'static str), /// Unsupported Segwit flag @@ -79,14 +70,11 @@ impl fmt::Display for Error { match *self { Error::Io(ref e) => write_err!(f, "IO error"; e), Error::Psbt(ref e) => write_err!(f, "PSBT error"; e), - Error::UnexpectedNetworkMagic { expected: ref e, actual: ref a } => write!(f, - "unexpected network magic: expected {}, actual {}", e, a), Error::OversizedVectorAllocation { requested: ref r, max: ref m } => write!(f, "allocation of oversized vector: requested {}, maximum {}", r, m), Error::InvalidChecksum { expected: ref e, actual: ref a } => write!(f, "invalid checksum: expected {}, actual {}", e.to_hex(), a.to_hex()), Error::NonMinimalVarInt => write!(f, "non-minimal varint"), - Error::UnknownNetworkMagic(ref m) => write!(f, "unknown network magic: {}", m), Error::ParseFailed(ref s) => write!(f, "parse failed: {}", s), Error::UnsupportedSegwitFlag(ref swflag) => write!(f, "unsupported segwit version: {}", swflag), @@ -103,11 +91,9 @@ impl std::error::Error for Error { match self { Io(e) => Some(e), Psbt(e) => Some(e), - UnexpectedNetworkMagic { .. } - | OversizedVectorAllocation { .. } + OversizedVectorAllocation { .. } | InvalidChecksum { .. } | NonMinimalVarInt - | UnknownNetworkMagic(_) | ParseFailed(_) | UnsupportedSegwitFlag(_) => None, }