bitcoin_coin_selection/
errors.rs

1/// Error types.
2
3#[derive(Clone, Debug, PartialEq)]
4/// Error types returned during the selection process when no match is found.
5pub enum SelectionError {
6    /// The sum of values passed is less than the target.  That is, There is no possible solution.
7    InsufficentFunds,
8    /// The maximum iteration count was reached returning no result.  That is, A solution
9    /// may exist but could not be found in a reasonable time.
10    IterationLimitReached,
11    /// The weight of a selection exceeded the max weight limit returning no result.
12    /// That is, No solutions could be found that are less than the `max_weight` parameter.
13    MaxWeightExceeded,
14    /// A numeric overflow occurred and the selection process aborted returning no result.
15    Overflow(OverflowError),
16    /// A generic error that should not happen assuming code paths behave as known.
17    ProgramError,
18    /// Search space was exhausted without yielding a result.  That is, iteration limit was not hit
19    /// and yet no solution could be found.
20    SolutionNotFound,
21}
22
23#[derive(Clone, Debug, PartialEq)]
24/// The possible numeric overflows that may occur.
25pub enum OverflowError {
26    /// Bounds overflowed while performing addition.
27    Addition,
28    /// Bounds overflowed wile performing multiplication.
29    Multiplication,
30    /// Bounds overflowed while performing subtraction.
31    Subtraction,
32}