1use bitcoin::Txid;
2
3#[derive(Debug, thiserror::Error)]
5pub enum MempoolError {
6 #[error("Transaction already in mempool")]
7 AlreadyInMempool,
8
9 #[error("Coinbase transaction not allowed")]
10 Coinbase,
11
12 #[error("Missing inputs: {parents:?}")]
13 MissingInputs { parents: Vec<Txid> },
14
15 #[error("Fee rate {actual_kvb} sat/kvB too low (min: {min_kvb})")]
16 FeeTooLow { min_kvb: u64, actual_kvb: u64 },
17
18 #[error("Invalid fee rate calculation: {0}")]
19 InvalidFeeRate(String),
20
21 #[error("Too many sigops: {0}")]
22 TooManySigops(i64),
23
24 #[error("Too many ancestors: {0}")]
25 TooManyAncestors(usize),
26
27 #[error("Ancestor size too large: {0}")]
28 AncestorSizeTooLarge(i64),
29
30 #[error("Too many descendants: {0}")]
31 TooManyDescendants(usize),
32
33 #[error("Descendant size too large: {0}")]
34 DescendantSizeTooLarge(i64),
35
36 #[error("Not standard: {0}")]
37 NotStandard(String),
38
39 #[error("Transaction version not standard")]
40 TxVersionNotStandard,
41
42 #[error("Transaction size too small")]
43 TxSizeTooSmall,
44
45 #[error("Non-final transaction")]
46 NonFinal,
47
48 #[error("Non-BIP68-final")]
49 NonBIP68Final,
50
51 #[error("Negative fee")]
52 NegativeFee,
53
54 #[error("Overflow in fee calculation")]
55 FeeOverflow,
56
57 #[error("Mempool is full")]
58 MempoolFull,
59
60 #[error("Transaction conflicts with mempool: {0}")]
61 TxConflict(String),
62
63 #[error("Script validation failed: {0}")]
64 ScriptValidationFailed(String),
65
66 #[error("No conflicting transaction to replace")]
67 NoConflictToReplace,
68
69 #[error("Conflicting transaction is not replaceable (doesn't signal BIP125)")]
70 TxNotReplaceable,
71
72 #[error("Too many transactions to replace: {0} (max 100)")]
73 TooManyReplacements(usize),
74
75 #[error("Replacement introduces new unconfirmed inputs")]
76 NewUnconfirmedInput,
77
78 #[error("Missing conflict transaction in mempool")]
79 MissingConflict,
80
81 #[error("Insufficient fee: {0}")]
82 InsufficientFee(String),
83
84 #[error("Package too large: {0} transactions (max {1})")]
85 PackageTooLarge(usize, usize),
86
87 #[error("Package exceeds size limit: {0} vbytes")]
88 PackageSizeTooLarge(u64),
89
90 #[error("Package has cyclic dependencies")]
91 PackageCyclicDependencies,
92
93 #[error("Package feerate too low: {0}")]
94 PackageFeeTooLow(String),
95
96 #[error("Package validation failed for tx {0}: {1}")]
97 PackageTxValidationFailed(bitcoin::Txid, String),
98
99 #[error("Package relay is disabled")]
100 PackageRelayDisabled,
101
102 #[error(transparent)]
103 TxError(#[from] subcoin_primitives::consensus::TxError),
104
105 #[error("Runtime API error: {0}")]
106 RuntimeApi(String),
107}