1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use std::collections::BTreeMap;
use std::io;
use thiserror::Error;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[allow(clippy::large_enum_variant)]
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error("Attempted an invalid operation {0}")]
InvalidOperation(String),
#[error("This input has a signature, but it doesn't appear in the transaction")]
UnknownInput,
#[error("Filtered input doesn't appear in the transaction")]
FilteredInputNotPresent,
#[error("Failed signature check.")]
FailedSignature,
#[error("Unrecognised authority.")]
UnrecognisedAuthority,
#[error("At least one transaction input is missing a signature.")]
MissingSignatureForInput,
#[error("At least one input is missing an ownership proof")]
MissingInputOwnerProof,
#[error("Mint request doesn't balance out sum(input) == sum(output)")]
DbcReissueRequestDoesNotBalance { input: u64, output: u64 },
#[error("Outputs must be numbered 0..N where N = # of outputs")]
OutputsAreNotNumberedCorrectly,
#[error("Failed to unblind an input DBC")]
FailedUnblinding,
#[error("DBC already spent in transaction: {transaction:?}")]
DbcAlreadySpent {
transaction: crate::DbcTransaction,
transaction_sigs:
BTreeMap<crate::DbcContentHash, (crate::PublicKeySet, crate::NodeSignature)>,
},
#[error("Genesis Input has already been spent in a different transaction")]
GenesisInputAlreadySpent,
#[error("This node is not a genesis node")]
NotGenesisNode,
#[error("The DBC transaction must have at least one input")]
TransactionMustHaveAnInput,
#[error("Dbc Content is not a member of transaction outputs")]
DbcContentNotPresentInTransactionOutput,
#[error("Dbc Content parents is not the same transaction inputs")]
DbcContentParentsDifferentFromTransactionInputs,
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("JSON serialisation error:: {0}")]
JsonSerialisation(#[from] serde_json::Error),
}