Add non_exhaustive to _all_ errors

We are no using `non_exhaustive` on any error types unless we are
_really_ sure there will be no additional variants required.

There are only three error enums that do not have it in the codebase as
of this commit, add it to all three.
This commit is contained in:
Tobin C. Harding 2022-07-28 11:54:54 +10:00
parent 9bac1a0b8b
commit a37ab82503
3 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ use crate::{Block, BlockHash, BlockHeader, Transaction};
/// A BIP-152 error /// A BIP-152 error
#[derive(Clone, PartialEq, Eq, Debug, Copy, PartialOrd, Ord, Hash)] #[derive(Clone, PartialEq, Eq, Debug, Copy, PartialOrd, Ord, Hash)]
#[non_exhaustive]
pub enum Error { pub enum Error {
/// An unknown version number was used. /// An unknown version number was used.
UnknownVersion, UnknownVersion,

View File

@ -57,6 +57,7 @@ const M: u64 = 784931;
/// Errors for blockfilter /// Errors for blockfilter
#[derive(Debug)] #[derive(Debug)]
#[non_exhaustive]
pub enum Error { pub enum Error {
/// missing UTXO, can not calculate script filter /// missing UTXO, can not calculate script filter
UtxoMissing(OutPoint), UtxoMissing(OutPoint),

View File

@ -55,6 +55,7 @@ use crate::{Block, BlockHeader};
/// An error when verifying the merkle block /// An error when verifying the merkle block
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
#[non_exhaustive]
pub enum MerkleBlockError { pub enum MerkleBlockError {
/// When header merkle root don't match to the root calculated from the partial merkle tree /// When header merkle root don't match to the root calculated from the partial merkle tree
MerkleRootMismatch, MerkleRootMismatch,