Skip to content

Commit 1cee6ea

Browse files
committed
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.
1 parent abaefaf commit 1cee6ea

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

channelnotifier/channelnotifier.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ type FullyResolvedChannelEvent struct {
8080
ChannelPoint *wire.OutPoint
8181
}
8282

83+
// FundingTimeoutEvent represents a new event where a pending-open channel has
84+
// timed out from the PoV of the funding manager because the funding tx
85+
// has not confirmed in the allotted time.
86+
type FundingTimeoutEvent struct {
87+
// ChannelPoint is the channelpoint for the newly inactive channel.
88+
ChannelPoint *wire.OutPoint
89+
}
90+
8391
// New creates a new channel notifier. The ChannelNotifier gets channel
8492
// events from peers and from the chain arbitrator, and dispatches them to
8593
// its clients.
@@ -184,6 +192,16 @@ func (c *ChannelNotifier) NotifyFullyResolvedChannelEvent(
184192
}
185193
}
186194

195+
// NotifyFundingTimeoutEvent notifies the channelEventNotifier goroutine that
196+
// a funding timeout has occurred for a certain channel point.
197+
func (c *ChannelNotifier) NotifyFundingTimeout(chanPoint wire.OutPoint) {
198+
// Send this event to all channel event subscribers.
199+
event := FundingTimeoutEvent{ChannelPoint: &chanPoint}
200+
if err := c.ntfnServer.SendUpdate(event); err != nil {
201+
log.Warnf("Unable to send funding timeout update: %v", err)
202+
}
203+
}
204+
187205
// NotifyActiveLinkEvent notifies the channelEventNotifier goroutine that a
188206
// link has been added to the switch.
189207
func (c *ChannelNotifier) NotifyActiveLinkEvent(chanPoint wire.OutPoint) {

0 commit comments

Comments
 (0)