#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("the amount is a whole number of sats")]
BadAmount,
#[error("bad address {0}")]
BadDestination(String),
#[error("insufficient: {have} sats mature, {need} needed")]
Insufficient {
have: u64,
need: u64,
},
#[error("insufficient coins for {amount} plus the {fee}-sat minimum fee")]
InsufficientForFee {
amount: u64,
fee: u64,
},
#[error("a peg-out burns at least {min} sats, not {value}")]
BelowPegoutMin {
value: u64,
min: u64,
},
#[error("fee {fee} is below the minimum {min} sats ({vsize} vB at {rate} sat/vB)")]
FeeBelowMinimum {
fee: u64,
min: u64,
vsize: u64,
rate: u64,
},
#[error("{value} sats to {script} is dust: at least {min} sats")]
Dust {
value: u64,
min: u64,
script: String,
},
#[error("{address} is not a {network} address: the parent is {parent}")]
WrongNetwork {
address: String,
network: String,
parent: String,
},
#[error(
"marker of {0} bytes exceeds the parent's 80-byte data limit; the chain id is too long"
)]
MarkerTooLong(usize),
#[error("policy refused: {0}")]
Policy(String),
#[error("signer: {0}")]
Signer(String),
#[error("producer refused: {0}")]
Refused(String),
#[error("json: {0}")]
Json(#[from] serde_json::Error),
#[error("encoding: {0}")]
Encoding(String),
#[error(transparent)]
Core(#[from] sidestr_core::Error),
#[error("secp256k1: {0}")]
Secp(#[from] bitcoin::secp256k1::Error),
#[cfg(feature = "client")]
#[error("http: {0}")]
Http(String),
}
pub type Result<T> = core::result::Result<T, Error>;