Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 18 variants BadAmount, BadDestination(String), Insufficient { have: u64, need: u64, }, InsufficientForFee { amount: u64, fee: u64, }, BelowPegoutMin { value: u64, min: u64, }, FeeBelowMinimum { fee: u64, min: u64, vsize: u64, rate: u64, }, Dust { value: u64, min: u64, script: String, }, WrongNetwork { address: String, network: String, parent: String, }, MarkerTooLong(usize), Policy(String), Signer(String), Asset(String), Refused(String), Json(Error), Encoding(String), Core(Error), Secp(Error), Http(String),
}
Expand description

Everything that can go wrong between “I want to pay” and a transaction the producer accepts.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

BadAmount

The amount is zero (spend.mjs: “the amount is a whole number of sats”).

§

BadDestination(String)

The destination is neither a script hex nor a segwit address under any prefix (spend.mjs resolveTo: “bad address …”).

§

Insufficient

The mature coins do not cover the amount plus the fee bound (spend.mjs: “insufficient: … sats mature, … needed”).

Fields

§have: u64

Sats the picked coins sum to.

§need: u64

Amount plus the fee bound.

§

InsufficientForFee

The coins covered the bound but not the fee the size came to (spend.mjs: “insufficient coins for … plus the …-sat minimum fee”).

Fields

§amount: u64

The amount wanted.

§fee: u64

The fee the sized transaction needs.

§

BelowPegoutMin

A burn below the document’s pegoutMin (SPEC 7; spend.mjs: “a peg-out burns at least … sats”).

Fields

§value: u64

The value asked for.

§min: u64

The document’s pegoutMin.

§

FeeBelowMinimum

An explicit fee under the producer’s minFeeRate policy, in the words State::submit would refuse it with.

Fields

§fee: u64

The fee given.

§min: u64

The least the producer accepts for this size.

§vsize: u64

The transaction’s virtual size.

§rate: u64

The document’s minFeeRate.

§

Dust

An output below Bitcoin’s dust threshold for its script: the chain would accept it and no wallet could economically spend it. The reference does not check; this crate does (see the crate docs).

Fields

§value: u64

The value asked for.

§min: u64

The dust threshold for that script.

§script: String

The script, hex.

§

WrongNetwork

A parent address for the wrong network: a peg-in to a bc1… address beside tbtc4, or the reverse (SPEC 6, 3.2).

Fields

§address: String

The address given.

§network: String

The network the parent alias resolves to.

§parent: String

The parent alias from the document.

§

MarkerTooLong(usize)

A parent-side marker (peg-in, peg-out record) longer than the parent’s 80-byte OP_RETURN relay policy allows, or any marker push over the 255 bytes the shared grammar reads back (a 61-byte peg-in marker for a 15-byte chain id fits).

§

Policy(String)

The SpendPolicy refused the intent.

§

Signer(String)

The SpendSigner could not sign.

§

Asset(String)

An issued-asset build the assets view would not read as asked (SPEC 12): too little of the asset, a memo shaped like an assets record, an input carrying another asset.

§

Refused(String)

A producer answered {"error": …} to a POST /tx.

§

Json(Error)

JSON that does not parse or does not fit the shape.

§

Encoding(String)

Hex or bytes that do not decode.

§

Core(Error)

An error from sidestr-core: a document naming an unknown parent, a marker that cannot be built.

§

Secp(Error)

A secp256k1 failure: a derived scalar out of range, a bad key.

§

Http(String)

An HTTP failure talking to a producer (feature client).

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.