mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
channelnotifier: add InactiveLinkEvent
This commit adds a new event `InactiveLinkEvent` to be used when a link becomes inactive.
This commit is contained in:
parent
ea0eb2ce72
commit
ced8833895
@ -47,6 +47,13 @@ type ActiveLinkEvent struct {
|
||||
ChannelPoint *wire.OutPoint
|
||||
}
|
||||
|
||||
// InactiveLinkEvent represents a new event where the link becomes inactive in
|
||||
// the switch.
|
||||
type InactiveLinkEvent struct {
|
||||
// ChannelPoint is the channel point for the inactive channel.
|
||||
ChannelPoint *wire.OutPoint
|
||||
}
|
||||
|
||||
// ActiveChannelEvent represents a new event where a channel becomes active.
|
||||
type ActiveChannelEvent struct {
|
||||
// ChannelPoint is the channelpoint for the newly active channel.
|
||||
@ -193,6 +200,15 @@ func (c *ChannelNotifier) NotifyActiveChannelEvent(chanPoint wire.OutPoint) {
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyInactiveLinkEvent notifies the channelEventNotifier goroutine that a
|
||||
// link has been removed from the switch.
|
||||
func (c *ChannelNotifier) NotifyInactiveLinkEvent(chanPoint wire.OutPoint) {
|
||||
event := InactiveLinkEvent{ChannelPoint: &chanPoint}
|
||||
if err := c.ntfnServer.SendUpdate(event); err != nil {
|
||||
log.Warnf("Unable to send inactive link update: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyInactiveChannelEvent notifies the channelEventNotifier goroutine that a
|
||||
// channel is inactive.
|
||||
func (c *ChannelNotifier) NotifyInactiveChannelEvent(chanPoint wire.OutPoint) {
|
||||
|
11
rpcserver.go
11
rpcserver.go
@ -4624,9 +4624,12 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
|
||||
},
|
||||
}
|
||||
|
||||
// Completely ignore ActiveLinkEvent as this is explicitly not
|
||||
// exposed to the RPC.
|
||||
case channelnotifier.ActiveLinkEvent:
|
||||
// Completely ignore ActiveLinkEvent and
|
||||
// InactiveLinkEvent as this is explicitly not exposed
|
||||
// to the RPC.
|
||||
case channelnotifier.ActiveLinkEvent,
|
||||
channelnotifier.InactiveLinkEvent:
|
||||
|
||||
continue
|
||||
|
||||
case channelnotifier.FullyResolvedChannelEvent:
|
||||
@ -7323,6 +7326,8 @@ func (r *rpcServer) SubscribeChannelBackups(req *lnrpc.ChannelBackupSubscription
|
||||
continue
|
||||
case channelnotifier.ActiveLinkEvent:
|
||||
continue
|
||||
case channelnotifier.InactiveLinkEvent:
|
||||
continue
|
||||
}
|
||||
|
||||
// Now that we know the channel state has changed,
|
||||
|
Loading…
Reference in New Issue
Block a user