channelnotifier: add FundingTimeout and NotifyFundingTimeout

This signal will be used in the server.go code to potentially
demote temporary-access peers to restricted-access peers.
This commit is contained in:
Eugene Siegel 2025-01-15 13:17:48 -05:00
parent 2d705d16a1
commit ca86eacf4f

View file

@ -80,6 +80,14 @@ type FullyResolvedChannelEvent struct {
ChannelPoint *wire.OutPoint
}
// FundingTimeoutEvent represents a new event where a pending-open channel has
// timed out from the PoV of the funding manager because the funding tx
// has not confirmed in the allotted time.
type FundingTimeoutEvent struct {
// ChannelPoint is the channelpoint for the newly inactive channel.
ChannelPoint *wire.OutPoint
}
// New creates a new channel notifier. The ChannelNotifier gets channel
// events from peers and from the chain arbitrator, and dispatches them to
// its clients.
@ -184,6 +192,16 @@ func (c *ChannelNotifier) NotifyFullyResolvedChannelEvent(
}
}
// NotifyFundingTimeoutEvent notifies the channelEventNotifier goroutine that
// a funding timeout has occurred for a certain channel point.
func (c *ChannelNotifier) NotifyFundingTimeout(chanPoint wire.OutPoint) {
// Send this event to all channel event subscribers.
event := FundingTimeoutEvent{ChannelPoint: &chanPoint}
if err := c.ntfnServer.SendUpdate(event); err != nil {
log.Warnf("Unable to send funding timeout update: %v", err)
}
}
// NotifyActiveLinkEvent notifies the channelEventNotifier goroutine that a
// link has been added to the switch.
func (c *ChannelNotifier) NotifyActiveLinkEvent(chanPoint wire.OutPoint) {