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

feat: fire channel open and closure events in lnd #849

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Conversation

im-adithya
Copy link
Member

Fixes #806

Adds a channel event susbcription to listen to channel closures.

closureReason can be the following:

  • "COOPERATIVE_CLOSE"
  • "LOCAL_FORCE_CLOSE"
  • "BREACH_CLOSE"
  • "REMOTE_FORCE_CLOSE"
  • "FUNDING_CANCELED"
  • "ABANDONED"

@im-adithya im-adithya requested a review from rolznz December 5, 2024 13:28
@im-adithya
Copy link
Member Author

We also can add a ChannelActive update publisher in the same PR but I'm not sure if it's the same as ChannelReady in LDK. Is ChannelReady triggered when peer connection is lost (making the channel inactive) and then connected again?

@rolznz
Copy link
Contributor

rolznz commented Dec 6, 2024

@im-adithya channel_ready in LDK is only triggered once, when the newly-opened channel is ready to be used

@rolznz
Copy link
Contributor

rolznz commented Dec 6, 2024

@im-adithya it would be good to also add the channel_ready event in this PR. Is there something equivalent in LND?

@im-adithya
Copy link
Member Author

channel_ready in LDK is only triggered once

Ah then LND doesn't have any similar method, I'll see if there's any alternate way of doing this

@rolznz
Copy link
Contributor

rolznz commented Dec 7, 2024

@im-adithya possibly we can subscribe to the ChannelActive event but only fire our event if it's the first time it becomes active. To ensure this, we could check if the current number of block confirmations is smaller than or equal to 6. (there is a chance the channel goes offline and on again, maybe there's a chance we get a duplicate event. But I think this should be rare?)

@im-adithya im-adithya changed the title feat: fire channel closure events in lnd feat: fire channel open and closure events in lnd Dec 10, 2024
@im-adithya
Copy link
Member Author

Sorry my bad, there actually is an open channel event as well 🤦 added now!

@rolznz
Copy link
Contributor

rolznz commented Dec 10, 2024

@im-adithya does that event run when the channel is opened or when it is opened AND the channel has the required confirmations?

@im-adithya
Copy link
Member Author

It only runs when the channel is ready to use (i.e when the min required block confirmations are done)

Copy link
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@rolznz rolznz merged commit 4b4e725 into master Dec 17, 2024
9 checks passed
@rolznz rolznz deleted the task-lnd-close branch December 17, 2024 04:42
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.

Fire channel closure events for LND
2 participants