Skip to content

Commit

Permalink
chore: include whether the channel is public or not in channel ready …
Browse files Browse the repository at this point in the history
…event
  • Loading branch information
rolznz committed Jul 31, 2024
1 parent e1adbe7 commit 9330162
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,11 +1236,20 @@ func (ls *LDKService) handleLdkEvent(event *ldk_node.Event) {

switch eventType := (*event).(type) {
case ldk_node.EventChannelReady:
channels := ls.node.ListChannels()
channelIndex := slices.IndexFunc(channels, func(c ldk_node.ChannelDetails) bool {
return c.ChannelId == eventType.ChannelId
})
if channelIndex == -1 {
logger.Logger.WithField("event", eventType).Error("Failed to find channel by ID")
return
}
ls.eventPublisher.Publish(&events.Event{
Event: "nwc_channel_ready",
Properties: map[string]interface{}{
"counterparty_node_id": eventType.CounterpartyNodeId,
"node_type": config.LDKBackendType,
"public": channels[channelIndex].IsPublic,
},
})

Expand Down

0 comments on commit 9330162

Please sign in to comment.