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 (#376)

* chore: include whether the channel is public or not in channel ready event

* chore: add capacity and is_outbound properties to channel ready event
  • Loading branch information
rolznz authored Jul 31, 2024
1 parent 2ec2cda commit 406e9f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,11 +1236,23 @@ 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
}
channel := channels[channelIndex]
ls.eventPublisher.Publish(&events.Event{
Event: "nwc_channel_ready",
Properties: map[string]interface{}{
"counterparty_node_id": eventType.CounterpartyNodeId,
"node_type": config.LDKBackendType,
"public": channel.IsPublic,
"capacity": channel.ChannelValueSats,
"is_outbound": channel.IsOutbound,
},
})

Expand Down

0 comments on commit 406e9f3

Please sign in to comment.