rustywallet_psbt/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error, Clone, PartialEq, Eq)]
7pub enum PsbtError {
8 #[error("invalid PSBT magic bytes")]
10 InvalidMagic,
11
12 #[error("invalid PSBT format: {0}")]
14 InvalidFormat(String),
15
16 #[error("missing required field: {0}")]
18 MissingField(String),
19
20 #[error("duplicate key in PSBT map")]
22 DuplicateKey,
23
24 #[error("invalid key type: 0x{0:02x}")]
26 InvalidKeyType(u8),
27
28 #[error("input index {0} out of bounds")]
30 InputIndexOutOfBounds(usize),
31
32 #[error("output index {0} out of bounds")]
34 OutputIndexOutOfBounds(usize),
35
36 #[error("cannot sign input: {0}")]
38 CannotSign(String),
39
40 #[error("incompatible PSBTs for combination")]
42 IncompatiblePsbts,
43
44 #[error("PSBT is not finalized")]
46 NotFinalized,
47
48 #[error("input is already finalized")]
50 AlreadyFinalized,
51
52 #[error("invalid signature")]
54 InvalidSignature,
55
56 #[error("unsupported PSBT version: {0}")]
58 UnsupportedVersion(u32),
59
60 #[error("serialization error: {0}")]
62 SerializationError(String),
63
64 #[error("base64 decode error: {0}")]
66 Base64Error(String),
67
68 #[error("invalid public key: {0}")]
70 InvalidPublicKey(String),
71
72 #[error("invalid script: {0}")]
74 InvalidScript(String),
75
76 #[error("missing UTXO information for input {0}")]
78 MissingUtxo(usize),
79
80 #[error("sighash type mismatch")]
82 SighashMismatch,
83
84 #[error("transaction mismatch between PSBTs")]
86 TransactionMismatch,
87
88 #[error("PSBT has no unsigned transaction")]
90 NoUnsignedTx,
91}