@@ -511,7 +511,7 @@ type Config struct {
511511
512512 // NotifyOpenChannelEvent informs the ChannelNotifier when channels
513513 // transition from pending open to open.
514- NotifyOpenChannelEvent func (wire.OutPoint )
514+ NotifyOpenChannelEvent func (wire.OutPoint , * btcec. PublicKey ) error
515515
516516 // OpenChannelPredicate is a predicate on the lnwire.OpenChannel message
517517 // and on the requesting node's public key that returns a bool which
@@ -521,7 +521,13 @@ type Config struct {
521521 // NotifyPendingOpenChannelEvent informs the ChannelNotifier when
522522 // channels enter a pending state.
523523 NotifyPendingOpenChannelEvent func (wire.OutPoint ,
524- * channeldb.OpenChannel )
524+ * channeldb.OpenChannel , * btcec.PublicKey ) error
525+
526+ // NotifyFundingTimeout informs the ChannelNotifier when a pending-open
527+ // channel times out because the funding transaction hasn't confirmed.
528+ // This is only called for the fundee and only if the channel is
529+ // zero-conf.
530+ NotifyFundingTimeout func (wire.OutPoint , * btcec.PublicKey ) error
525531
526532 // EnableUpfrontShutdown specifies whether the upfront shutdown script
527533 // is enabled.
@@ -1313,7 +1319,13 @@ func (f *Manager) advancePendingChannelState(channel *channeldb.OpenChannel,
13131319
13141320 // Inform the ChannelNotifier that the channel has transitioned
13151321 // from pending open to open.
1316- f .cfg .NotifyOpenChannelEvent (channel .FundingOutpoint )
1322+ if err := f .cfg .NotifyOpenChannelEvent (
1323+ channel .FundingOutpoint , channel .IdentityPub ,
1324+ ); err != nil {
1325+ log .Errorf ("Unable to notify open channel event for " +
1326+ "ChannelPoint(%v): %v" ,
1327+ channel .FundingOutpoint , err )
1328+ }
13171329
13181330 // Find and close the discoverySignal for this channel such
13191331 // that ChannelReady messages will be processed.
@@ -2654,7 +2666,12 @@ func (f *Manager) fundeeProcessFundingCreated(peer lnpeer.Peer,
26542666
26552667 // Inform the ChannelNotifier that the channel has entered
26562668 // pending open state.
2657- f .cfg .NotifyPendingOpenChannelEvent (fundingOut , completeChan )
2669+ if err := f .cfg .NotifyPendingOpenChannelEvent (
2670+ fundingOut , completeChan , completeChan .IdentityPub ,
2671+ ); err != nil {
2672+ log .Errorf ("Unable to send pending-open channel event for " +
2673+ "ChannelPoint(%v) %v" , fundingOut , err )
2674+ }
26582675
26592676 // At this point we have sent our last funding message to the
26602677 // initiating peer before the funding transaction will be broadcast.
@@ -2874,7 +2891,14 @@ func (f *Manager) funderProcessFundingSigned(peer lnpeer.Peer,
28742891 case resCtx .updates <- upd :
28752892 // Inform the ChannelNotifier that the channel has entered
28762893 // pending open state.
2877- f .cfg .NotifyPendingOpenChannelEvent (* fundingPoint , completeChan )
2894+ if err := f .cfg .NotifyPendingOpenChannelEvent (
2895+ * fundingPoint , completeChan , completeChan .IdentityPub ,
2896+ ); err != nil {
2897+ log .Errorf ("Unable to send pending-open channel " +
2898+ "event for ChannelPoint(%v) %v" , fundingPoint ,
2899+ err )
2900+ }
2901+
28782902 case <- f .quit :
28792903 return
28802904 }
@@ -2930,6 +2954,13 @@ func (f *Manager) fundingTimeout(c *channeldb.OpenChannel,
29302954 c .FundingOutpoint , err )
29312955 }
29322956
2957+ // Notify other subsystems about the funding timeout.
2958+ err := f .cfg .NotifyFundingTimeout (c .FundingOutpoint , c .IdentityPub )
2959+ if err != nil {
2960+ log .Errorf ("failed to notify of funding timeout for " +
2961+ "ChanPoint(%v): %v" , c .FundingOutpoint , err )
2962+ }
2963+
29332964 timeoutErr := fmt .Errorf ("timeout waiting for funding tx (%v) to " +
29342965 "confirm" , c .FundingOutpoint )
29352966
@@ -3310,7 +3341,13 @@ func (f *Manager) handleFundingConfirmation(
33103341
33113342 // Inform the ChannelNotifier that the channel has transitioned from
33123343 // pending open to open.
3313- f .cfg .NotifyOpenChannelEvent (completeChan .FundingOutpoint )
3344+ if err := f .cfg .NotifyOpenChannelEvent (
3345+ completeChan .FundingOutpoint , completeChan .IdentityPub ,
3346+ ); err != nil {
3347+ log .Errorf ("Unable to notify open channel event for " +
3348+ "ChannelPoint(%v): %v" , completeChan .FundingOutpoint ,
3349+ err )
3350+ }
33143351
33153352 // Close the discoverySignal channel, indicating to a separate
33163353 // goroutine that the channel now is marked as open in the database
0 commit comments