Skip to content

Commit fe46413

Browse files
committed
Add sled dependency and error handling
1 parent 74142a7 commit fe46413

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lightning-background-processor = { version = "0.0.110" }
1616
lightning-rapid-gossip-sync = { version = "0.0.110" }
1717

1818
#bdk = "0.20.0"
19-
bdk = { git = "https://github.com/tnull/bdk", branch="feat/use-external-esplora-client", features = ["use-esplora-ureq"]}
19+
bdk = { git = "https://github.com/tnull/bdk", branch="feat/use-external-esplora-client", features = ["use-esplora-ureq", "key-value-db"]}
2020
bitcoin = "0.28.1"
2121

2222
rand = "0.8.5"

src/error.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ pub enum LdkLiteError {
1919
FundingTxNonWitnessOuputSpend,
2020
/// The funding transaction could not be finalized.
2121
FundingTxNotFinalized,
22-
/// TODO
23-
ChainStateMismatch,
2422
/// A network connection has been closed.
2523
ConnectionFailed,
2624
/// A given peer info could not be parsed.
@@ -54,12 +52,10 @@ impl fmt::Display for LdkLiteError {
5452
LdkLiteError::NotRunning => write!(f, "LDKLite is not running."),
5553
LdkLiteError::FundingTxNonWitnessOuputSpend => write!(f, "an input of the funding transaction tried spending a non-SegWit output, which is insecure"),
5654
LdkLiteError::FundingTxNotFinalized => write!(f, "the funding transaction could not be finalized"),
57-
LdkLiteError::ChainStateMismatch => write!(f, "ChainStateMismatch"),
5855
LdkLiteError::ConnectionFailed => write!(f, "network connection closed"),
5956
LdkLiteError::PeerInfoParse(ref e) => write!(f, "given peer info could not be parsed: {}", e),
6057
LdkLiteError::LdkDecode(ref e) => write!(f, "LDK decode error: {}", e),
6158
LdkLiteError::LdkApi(ref e) => write!(f, "LDK API error: {:?}", e),
62-
// TODO: print more sensible things based on the type of payment error
6359
LdkLiteError::LdkPayment(ref e) => write!(f, "LDK payment error: {:?}", e),
6460
LdkLiteError::LdkInvoiceCreation(ref e) => write!(f, "LDK invoice sign or creation error: {:?}", e),
6561
LdkLiteError::Bdk(ref e) => write!(f, "BDK error: {}", e),
@@ -102,15 +98,15 @@ impl From<bdk::Error> for LdkLiteError {
10298
}
10399
}
104100

105-
impl From<bitcoin::util::bip32::Error> for LdkLiteError {
106-
fn from(e: bitcoin::util::bip32::Error) -> Self {
107-
Self::Bip32(e)
101+
impl From<bdk::sled::Error> for LdkLiteError {
102+
fn from(e: bdk::sled::Error) -> Self {
103+
Self::Bdk(bdk::Error::Sled(e))
108104
}
109105
}
110106

111-
impl From<bdk::electrum_client::Error> for LdkLiteError {
112-
fn from(e: bdk::electrum_client::Error) -> Self {
113-
Self::Bdk(bdk::Error::Electrum(e))
107+
impl From<bitcoin::util::bip32::Error> for LdkLiteError {
108+
fn from(e: bitcoin::util::bip32::Error) -> Self {
109+
Self::Bip32(e)
114110
}
115111
}
116112

0 commit comments

Comments
 (0)