-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy patherror.rs
More file actions
71 lines (68 loc) · 2.83 KB
/
error.rs
File metadata and controls
71 lines (68 loc) · 2.83 KB
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
64
65
66
67
68
69
70
71
use thiserror::Error;
use common::chain::transaction::Transaction;
use common::chain::OutPoint;
use common::primitives::amount::Amount;
use common::primitives::Id;
use common::primitives::H256;
#[derive(Debug, Error)]
pub enum Error {
#[error("Mempool is full")]
MempoolFull,
#[error(transparent)]
TxValidationError(#[from] TxValidationError),
}
#[derive(Debug, Error)]
pub enum TxValidationError {
#[error("Transaction has no inputs.")]
NoInputs,
#[error("Transaction has no outputs.")]
NoOutputs,
#[error("Transaction has duplicate inputs.")]
DuplicateInputs,
#[error("Outpoint not found: {outpoint:?}")]
OutPointNotFound {
outpoint: OutPoint,
tx_id: Id<Transaction>,
},
#[error("Transaction exceeds the maximum block size.")]
ExceedsMaxBlockSize,
#[error("Transaction already exists in the mempool.")]
TransactionAlreadyInMempool,
#[error("Transaction conflicts with another, irreplaceable transaction.")]
ConflictWithIrreplaceableTransaction,
#[error("The sum of the transaction's inputs' values overflows.")]
InputValuesOverflow,
#[error("The sum of the transaction's outputs' values overflows.")]
OutputValuesOverflow,
#[error("The sum of the transaction's inputs is smaller than the sum of its outputs.")]
InputsBelowOutputs,
#[error("Replacement transaction has fee lower than the original. Replacement fee is {replacement_fee:?}, original fee {original_fee:?}")]
ReplacementFeeLowerThanOriginal {
replacement_tx: H256,
replacement_fee: Amount,
original_tx: H256,
original_fee: Amount,
},
#[error("Transaction would require too many replacements.")]
TooManyPotentialReplacements,
#[error("Replacement transaction spends an unconfirmed input which was not spent by any of the original transactions.")]
SpendsNewUnconfirmedOutput,
#[error("The sum of the fees of this transaction's conflicts overflows.")]
ConflictsFeeOverflow,
#[error("Transaction pays a fee that is lower than the fee of its conflicts with their descendants.")]
TransactionFeeLowerThanConflictsWithDescendants,
#[error("Underflow in computing transaction's additional fees.")]
AdditionalFeesUnderflow,
#[error("Transaction does not pay sufficient fees to be relayed.")]
InsufficientFeesToRelay { tx_fee: Amount, relay_fee: Amount },
#[error("Replacement transaction does not pay enough for its bandwidth.")]
InsufficientFeesToRelayRBF,
#[error("Rolling fee threshold not met.")]
RollingFeeThresholdNotMet { minimum_fee: Amount, tx_fee: Amount },
#[error("Overflow encountered while updating ancestor fee.")]
AncestorFeeUpdateOverflow,
#[error("Transaction is a descendant of expired transaction.")]
DescendantOfExpiredTransaction,
#[error("Internal Error.")]
InternalError,
}