mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
rpc: Add PendingOpenChannel to SubscribeChannelEvents
This commit adds PendingOpenChannel to SubscribeChannelEvents stream in the gRPC API. This is useful for keeping track of channel openings that Autopilot does. It can also be used for the non-initator side of a channel opening to keep track of channel openings.
This commit is contained in:
@@ -20,6 +20,13 @@ type ChannelNotifier struct {
|
||||
chanDB *channeldb.DB
|
||||
}
|
||||
|
||||
// PendingOpenChannelEvent represents a new event where a new channel has
|
||||
// entered a pending open state.
|
||||
type PendingOpenChannelEvent struct {
|
||||
// ChannelPoint is the channelpoint for the new channel.
|
||||
ChannelPoint *wire.OutPoint
|
||||
}
|
||||
|
||||
// OpenChannelEvent represents a new event where a channel goes from pending
|
||||
// open to open.
|
||||
type OpenChannelEvent struct {
|
||||
@@ -82,6 +89,16 @@ func (c *ChannelNotifier) SubscribeChannelEvents() (*subscribe.Client, error) {
|
||||
return c.ntfnServer.Subscribe()
|
||||
}
|
||||
|
||||
// NotifyPendingOpenChannelEvent notifies the channelEventNotifier goroutine that a
|
||||
// new channel is pending.
|
||||
func (c *ChannelNotifier) NotifyPendingOpenChannelEvent(chanPoint wire.OutPoint) {
|
||||
event := PendingOpenChannelEvent{ChannelPoint: &chanPoint}
|
||||
|
||||
if err := c.ntfnServer.SendUpdate(event); err != nil {
|
||||
log.Warnf("Unable to send pending open channel update: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// NotifyOpenChannelEvent notifies the channelEventNotifier goroutine that a
|
||||
// channel has gone from pending open to open.
|
||||
func (c *ChannelNotifier) NotifyOpenChannelEvent(chanPoint wire.OutPoint) {
|
||||
|
Reference in New Issue
Block a user