Skip to content

feat: async support for dlc-manager - #235

Open
bennyhodl wants to merge 1 commit into
p2pderivatives:masterfrom
bennyhodl:async
Open

feat: async support for dlc-manager#235
bennyhodl wants to merge 1 commit into
p2pderivatives:masterfrom
bennyhodl:async

Conversation

@bennyhodl

Copy link
Copy Markdown
Contributor

builds on top of #234

Adds a feature flag of async. There are functions for less reliance on oracles for creating offers and closing contracts. In my implementation of dlcdevkit the consumers are typically going to use async runtimes with gRPC servers, REST servers, tauri, etc. Manually closing contracts and tracking for attestations created code and solutions that I was not happy with for something I believe should be handled internally in the library.

I think that dlc-manager should manage contracts agnostic to runtimes. I.e. not having to spawn a blocking thread for periodic checks.

This makes the manual close for situations in which an attestation is produced before the maturity. Not necessarily for async runtimes that are not running periodic checks for confirmed contracts.

@Tibo-lg

Tibo-lg commented Oct 7, 2024

Copy link
Copy Markdown
Contributor

Having async interfaces would definitely be nice but that's something I'd like to give some thinking rather than just duplicating code tbh. I know bdk and ldk are using some macros to make this better and I'd probably want to check that first before considering which approach to take.

@bennyhodl

Copy link
Copy Markdown
Contributor Author

Understood, looking at the bdk-macros crate it just supports for wasm targets. Would have to fork the code for the async feature. We could have the maybe async oracle trait and then call [maybe_await] for the calls for attestations and announcements.

Will have to change all of the iterators to for loops to keep the calls to the Oracle traits the same.

Would this be worthwhile to try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants