rustywallet_multisig/
error.rs1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, MultisigError>;
7
8#[derive(Debug, Error)]
10pub enum MultisigError {
11 #[error("Invalid threshold: M={m} must be >= 1 and <= N={n}")]
13 InvalidThreshold { m: u8, n: u8 },
14
15 #[error("Too many keys: {count} (max 15)")]
17 TooManyKeys { count: usize },
18
19 #[error("Not enough keys: need {need}, got {got}")]
21 NotEnoughKeys { need: usize, got: usize },
22
23 #[error("Duplicate public key at index {index}")]
25 DuplicateKey { index: usize },
26
27 #[error("Invalid public key: {0}")]
29 InvalidPublicKey(String),
30
31 #[error("Invalid redeem script: {0}")]
33 InvalidRedeemScript(String),
34
35 #[error("Not enough signatures: need {need}, got {got}")]
37 NotEnoughSignatures { need: usize, got: usize },
38
39 #[error("Invalid signature at index {index}: {reason}")]
41 InvalidSignature { index: usize, reason: String },
42
43 #[error("Shamir error: {0}")]
45 ShamirError(String),
46
47 #[error("Invalid share index: {0} (must be 1-255)")]
49 InvalidShareIndex(u8),
50
51 #[error("Duplicate share index: {0}")]
53 DuplicateShareIndex(u8),
54
55 #[error("Signing failed: {0}")]
57 SigningFailed(String),
58
59 #[error("Address generation failed: {0}")]
61 AddressFailed(String),
62}