Merge rust-bitcoin/rust-bitcoin#1252: Remove unused consensus encoding error variants
57c4283220
Remove unused consensus encoding error variants (Martin Habovstiak) Pull request description: The error variants `UnexpectedNetworkMagic` and `UnknownNetworkMagic` were not only duplicated but also completely unused. This removes both of them. ACKs for top commit: tcharding: ACK57c4283220
apoelstra: ACK57c4283220
Tree-SHA512: 3e686f54dee038500712e6960aeb3a633d95a6302f782b9b756a8a32f6b9eff805a7b63f2190c57ed806d6dfd7585b2f335bd8d5c5bfbe2c1b27e4761fd96625
This commit is contained in:
commit
3ebf3d57b4
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue