chore: add from to cannotconnecterror
This commit is contained in:
parent
75d155c67a
commit
9b5b96710e
@ -20,6 +20,8 @@ use bdk::miniscript::descriptor::DescriptorKeyParseError as BdkDescriptorKeyPars
|
|||||||
|
|
||||||
use bdk::bitcoin::bip32;
|
use bdk::bitcoin::bip32;
|
||||||
|
|
||||||
|
use bdk::chain;
|
||||||
|
|
||||||
use bdk::wallet::error::CreateTxError as BdkCreateTxError;
|
use bdk::wallet::error::CreateTxError as BdkCreateTxError;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
@ -547,6 +549,14 @@ impl From<BdkCalculateFeeError> for CalculateFeeError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<chain::local_chain::CannotConnectError> for CannotConnectError {
|
||||||
|
fn from(error: chain::local_chain::CannotConnectError) -> Self {
|
||||||
|
CannotConnectError::Include {
|
||||||
|
height: error.try_include_height,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<BdkCreateTxError<std::io::Error>> for CreateTxError {
|
impl From<BdkCreateTxError<std::io::Error>> for CreateTxError {
|
||||||
fn from(error: BdkCreateTxError<std::io::Error>) -> Self {
|
fn from(error: BdkCreateTxError<std::io::Error>) -> Self {
|
||||||
match error {
|
match error {
|
||||||
|
@ -59,9 +59,7 @@ impl Wallet {
|
|||||||
pub fn apply_update(&self, update: Arc<Update>) -> Result<(), CannotConnectError> {
|
pub fn apply_update(&self, update: Arc<Update>) -> Result<(), CannotConnectError> {
|
||||||
self.get_wallet()
|
self.get_wallet()
|
||||||
.apply_update(update.0.clone())
|
.apply_update(update.0.clone())
|
||||||
.map_err(|e| CannotConnectError::Include {
|
.map_err(CannotConnectError::from)
|
||||||
height: e.try_include_height,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is the fallible version of get_internal_address; should I rename it to get_internal_address?
|
// TODO: This is the fallible version of get_internal_address; should I rename it to get_internal_address?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user