-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This crate provides utilities for syncing LDK via the transaction-based `Confirm` interface. The initial implementation facilitates synchronization with an Esplora backend server.
- Loading branch information
Showing
6 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "lightning-transaction-sync" | ||
version = "0.0.112" | ||
authors = ["Elias Rohrer"] | ||
license = "MIT OR Apache-2.0" | ||
repository = "http://github.com/lightningdevkit/rust-lightning" | ||
description = """ | ||
Utilities for syncing LDK via the transaction-based `Confirm` interface. | ||
""" | ||
edition = "2018" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[features] | ||
default = ["esplora-blocking"] | ||
esplora-async = ["async-interface", "esplora-client/async", "tokio"] | ||
esplora-blocking = ["esplora-client/blocking"] | ||
async-interface = [] | ||
|
||
[dependencies] | ||
lightning = { version = "0.0.112", path = "../lightning" } | ||
bitcoin = "0.29.0" | ||
bdk-macros = "0.6" | ||
tokio = { version = "1.0", default-features = false, features = [], optional = true } | ||
esplora-client = { git = "https://github.com/tnull/rust-esplora-client", branch = "2022-10-get-merkle-block", default-features = false, optional = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::fmt; | ||
use esplora_client::Error as EsploraError; | ||
|
||
#[derive(Debug)] | ||
/// An error that possibly needs to be handled by the user. | ||
pub enum TxSyncError { | ||
/// A transaction sync failed. | ||
Failed, | ||
/// An inconsisteny was encounterd during transaction sync. | ||
Inconsistency, | ||
} | ||
|
||
impl fmt::Display for TxSyncError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match *self { | ||
Self::Failed => write!(f, "Failed to conduct transaction sync."), | ||
Self::Inconsistency => { | ||
write!(f, "Encountered an inconsisteny during transaction sync.") | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl std::error::Error for TxSyncError {} | ||
|
||
impl From<EsploraError> for TxSyncError { | ||
fn from(_e: EsploraError) -> Self { | ||
Self::Failed | ||
} | ||
} |
Oops, something went wrong.