Skip to content

Commit

Permalink
feat: Async support for dlc-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
bennyhodl committed Oct 7, 2024
1 parent 0d16b4b commit a524609
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dlc-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ std = ["dlc/std", "dlc-messages/std", "dlc-trie/std", "bitcoin/std", "lightning/
fuzztarget = ["rand_chacha"]
parallel = ["dlc-trie/parallel"]
use-serde = ["serde", "dlc/use-serde", "dlc-messages/use-serde", "dlc-trie/use-serde"]
async = ["dep:futures"]

[dependencies]
async-trait = "0.1.50"
bitcoin = { version = "0.32.2", default-features = false }
dlc = { version = "0.6.0", default-features = false, path = "../dlc" }
dlc-messages = { version = "0.6.0", default-features = false, path = "../dlc-messages" }
dlc-trie = { version = "0.6.0", default-features = false, path = "../dlc-trie" }
futures = { version = "0.3.30", optional = true }
hex = { package = "hex-conservative", version = "0.1" }
lightning = { version = "0.0.124", default-features = false, features = ["grind_signatures"] }
log = "0.4.14"
Expand Down
14 changes: 14 additions & 0 deletions dlc-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,23 @@ pub trait Oracle {
/// Returns the public key of the oracle.
fn get_public_key(&self) -> XOnlyPublicKey;
/// Returns the announcement for the event with the given id if found.
#[cfg(not(feature = "async"))]
fn get_announcement(&self, event_id: &str) -> Result<OracleAnnouncement, Error>;
/// Returns the attestation for the event with the given id if found.
#[cfg(not(feature = "async"))]
fn get_attestation(&self, event_id: &str) -> Result<OracleAttestation, Error>;
/// Returns the announcement for the event with the given id if found.
#[cfg(feature = "async")]
fn get_announcement(
&self,
event_id: &str,
) -> impl std::future::Future<Output = Result<OracleAnnouncement, Error>> + Send;
/// Returns the attestation for the event with the given id if found.
#[cfg(feature = "async")]
fn get_attestation(
&self,
event_id: &str,
) -> impl std::future::Future<Output = Result<OracleAttestation, Error>> + Send;
}

/// Represents a UTXO.
Expand Down
Loading

0 comments on commit a524609

Please sign in to comment.