rustywallet_taproot/
error.rs

1//! Taproot error types
2
3use thiserror::Error;
4
5/// Errors that can occur when working with Taproot
6#[derive(Debug, Error, Clone, PartialEq, Eq)]
7pub enum TaprootError {
8    /// Invalid x-only public key
9    #[error("invalid x-only public key")]
10    InvalidXOnlyKey,
11
12    /// Invalid signature
13    #[error("invalid signature")]
14    InvalidSignature,
15
16    /// Invalid tweak value
17    #[error("invalid tweak: {0}")]
18    InvalidTweak(String),
19
20    /// Invalid leaf version
21    #[error("invalid leaf version: 0x{0:02x}")]
22    InvalidLeafVersion(u8),
23
24    /// Invalid control block
25    #[error("invalid control block: {0}")]
26    InvalidControlBlock(String),
27
28    /// Tree construction error
29    #[error("tree construction error: {0}")]
30    TreeError(String),
31
32    /// Verification failed
33    #[error("verification failed")]
34    VerificationFailed,
35
36    /// Invalid script
37    #[error("invalid script: {0}")]
38    InvalidScript(String),
39
40    /// Invalid parity
41    #[error("invalid parity value")]
42    InvalidParity,
43
44    /// Secp256k1 error
45    #[error("secp256k1 error: {0}")]
46    Secp256k1Error(String),
47
48    /// Invalid length
49    #[error("invalid length: expected {expected}, got {got}")]
50    InvalidLength { expected: usize, got: usize },
51
52    /// Empty tree
53    #[error("cannot build empty tree")]
54    EmptyTree,
55
56    /// Invalid merkle path
57    #[error("invalid merkle path")]
58    InvalidMerklePath,
59}