Skip to content

Commit 866a083

Browse files
committed
feat: Async support for dlc-manager
1 parent f0aec42 commit 866a083

File tree

3 files changed

+360
-0
lines changed

3 files changed

+360
-0
lines changed

Diff for: dlc-manager/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ std = ["dlc/std", "dlc-messages/std", "dlc-trie/std", "bitcoin/std", "lightning/
1414
fuzztarget = ["rand_chacha"]
1515
parallel = ["dlc-trie/parallel"]
1616
use-serde = ["serde", "dlc/use-serde", "dlc-messages/use-serde", "dlc-trie/use-serde"]
17+
async = ["dep:futures"]
1718

1819
[dependencies]
1920
async-trait = "0.1.50"
2021
bitcoin = { version = "0.32.2", default-features = false }
2122
dlc = { version = "0.6.0", default-features = false, path = "../dlc" }
2223
dlc-messages = { version = "0.6.0", default-features = false, path = "../dlc-messages" }
2324
dlc-trie = { version = "0.6.0", default-features = false, path = "../dlc-trie" }
25+
futures = { version = "0.3.30", optional = true }
2426
hex = { package = "hex-conservative", version = "0.1" }
2527
lightning = { version = "0.0.124", default-features = false, features = ["grind_signatures"] }
2628
log = "0.4.14"

Diff for: dlc-manager/src/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,23 @@ pub trait Oracle {
230230
/// Returns the public key of the oracle.
231231
fn get_public_key(&self) -> XOnlyPublicKey;
232232
/// Returns the announcement for the event with the given id if found.
233+
#[cfg(not(feature = "async"))]
233234
fn get_announcement(&self, event_id: &str) -> Result<OracleAnnouncement, Error>;
234235
/// Returns the attestation for the event with the given id if found.
236+
#[cfg(not(feature = "async"))]
235237
fn get_attestation(&self, event_id: &str) -> Result<OracleAttestation, Error>;
238+
/// Returns the announcement for the event with the given id if found.
239+
#[cfg(feature = "async")]
240+
fn get_announcement(
241+
&self,
242+
event_id: &str,
243+
) -> impl std::future::Future<Output = Result<OracleAnnouncement, Error>> + Send;
244+
/// Returns the attestation for the event with the given id if found.
245+
#[cfg(feature = "async")]
246+
fn get_attestation(
247+
&self,
248+
event_id: &str,
249+
) -> impl std::future::Future<Output = Result<OracleAttestation, Error>> + Send;
236250
}
237251

238252
/// Represents a UTXO.

0 commit comments

Comments
 (0)