Merge commit 'refs/pull/213/head' of github.com:bitcoindevkit/bdk
This commit is contained in:
commit
592c37897e
@ -553,20 +553,10 @@ impl fmt::Display for CompactFiltersError {
|
||||
|
||||
impl std::error::Error for CompactFiltersError {}
|
||||
|
||||
macro_rules! impl_error {
|
||||
( $from:ty, $to:ident ) => {
|
||||
impl std::convert::From<$from> for CompactFiltersError {
|
||||
fn from(err: $from) -> Self {
|
||||
CompactFiltersError::$to(err)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl_error!(rocksdb::Error, DB);
|
||||
impl_error!(std::io::Error, IO);
|
||||
impl_error!(bitcoin::util::bip158::Error, BIP158);
|
||||
impl_error!(std::time::SystemTimeError, Time);
|
||||
impl_error!(rocksdb::Error, DB, CompactFiltersError);
|
||||
impl_error!(std::io::Error, IO, CompactFiltersError);
|
||||
impl_error!(bitcoin::util::bip158::Error, BIP158, CompactFiltersError);
|
||||
impl_error!(std::time::SystemTimeError, Time, CompactFiltersError);
|
||||
|
||||
impl From<crate::error::Error> for CompactFiltersError {
|
||||
fn from(err: crate::error::Error) -> Self {
|
||||
|
@ -47,7 +47,7 @@ use serde::Deserialize;
|
||||
|
||||
use reqwest::{Client, StatusCode};
|
||||
|
||||
use bitcoin::consensus::{deserialize, serialize};
|
||||
use bitcoin::consensus::{self, deserialize, serialize};
|
||||
use bitcoin::hashes::hex::{FromHex, ToHex};
|
||||
use bitcoin::hashes::{sha256, Hash};
|
||||
use bitcoin::{BlockHash, BlockHeader, Script, Transaction, Txid};
|
||||
@ -423,26 +423,7 @@ impl fmt::Display for EsploraError {
|
||||
|
||||
impl std::error::Error for EsploraError {}
|
||||
|
||||
impl From<reqwest::Error> for EsploraError {
|
||||
fn from(other: reqwest::Error) -> Self {
|
||||
EsploraError::Reqwest(other)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::num::ParseIntError> for EsploraError {
|
||||
fn from(other: std::num::ParseIntError) -> Self {
|
||||
EsploraError::Parsing(other)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bitcoin::consensus::encode::Error> for EsploraError {
|
||||
fn from(other: bitcoin::consensus::encode::Error) -> Self {
|
||||
EsploraError::BitcoinEncoding(other)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bitcoin::hashes::hex::Error> for EsploraError {
|
||||
fn from(other: bitcoin::hashes::hex::Error) -> Self {
|
||||
EsploraError::Hex(other)
|
||||
}
|
||||
}
|
||||
impl_error!(reqwest::Error, Reqwest, EsploraError);
|
||||
impl_error!(std::num::ParseIntError, Parsing, EsploraError);
|
||||
impl_error!(consensus::encode::Error, BitcoinEncoding, EsploraError);
|
||||
impl_error!(bitcoin::hashes::hex::Error, Hex, EsploraError);
|
||||
|
@ -110,9 +110,12 @@ impl std::error::Error for Error {}
|
||||
|
||||
macro_rules! impl_error {
|
||||
( $from:ty, $to:ident ) => {
|
||||
impl std::convert::From<$from> for Error {
|
||||
impl_error!($from, $to, Error);
|
||||
};
|
||||
( $from:ty, $to:ident, $impl_for:ty ) => {
|
||||
impl std::convert::From<$from> for $impl_for {
|
||||
fn from(err: $from) -> Self {
|
||||
Error::$to(err)
|
||||
<$impl_for>::$to(err)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -679,17 +679,8 @@ pub enum KeyError {
|
||||
Miniscript(miniscript::Error),
|
||||
}
|
||||
|
||||
impl From<miniscript::Error> for KeyError {
|
||||
fn from(inner: miniscript::Error) -> Self {
|
||||
KeyError::Miniscript(inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bitcoin::util::bip32::Error> for KeyError {
|
||||
fn from(inner: bitcoin::util::bip32::Error) -> Self {
|
||||
KeyError::BIP32(inner)
|
||||
}
|
||||
}
|
||||
impl_error!(miniscript::Error, Miniscript, KeyError);
|
||||
impl_error!(bitcoin::util::bip32::Error, BIP32, KeyError);
|
||||
|
||||
impl std::fmt::Display for KeyError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
|
Loading…
x
Reference in New Issue
Block a user