Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LDK ChannelManager for OfferMessageHandler #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kannapoix
Copy link

@kannapoix kannapoix commented Dec 29, 2024

Closes #14
I would like to address this issue before working on updating to ldk v0.0.125. During my work to update ldk to v0.0125, I have got many conflicts. Cutoff codes by using the default implementation make it easy to resolve conflicts.

LDK ChannelManager now implements OfferMessageHandler. So we can use the default SimpleArcOnionMessenger as the OnionMessenger type.

This change doesn't work with the current lndk integration tests. In this PR we are going to use channel_manager.create_offer_builder() to create an offer. However, this method throws an error if it can't find a peer with more than 3 channels. In lndk integration test, the peer has one channel because the network is really simple. This causes test to fail. To test passed, we can implement a custom MessageRouter (because the restriction is implemented by defaultMessageRouter) or add more channels to the peer. I think the latter is simple and sufficient for here. I have confirmed that the latter works fine with this PR. New test looks like this.

LDK ChannelManager now implements OfferMessageHandler. So we can use the default SimpleArcOnionMessenger as the OnionMessenger type.
Remove the OnionMessageHandler and OffersMessageHandler implementations, as they're replaced by LDK implementations.
To create an offer, we use the create_offer_builder method as noted in the document: https://docs.rs/lightning/0.0.123/lightning/offers/offer/struct.OfferBuilder.html#note
@kannapoix kannapoix marked this pull request as ready for review December 30, 2024 00:32
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.

Update OnionMessenger to use ChannelManager as message handler
1 participant