@@ -510,7 +510,7 @@ type Config struct {
510
510
511
511
// NotifyOpenChannelEvent informs the ChannelNotifier when channels
512
512
// transition from pending open to open.
513
- NotifyOpenChannelEvent func (wire.OutPoint )
513
+ NotifyOpenChannelEvent func (wire.OutPoint , * btcec. PublicKey ) error
514
514
515
515
// OpenChannelPredicate is a predicate on the lnwire.OpenChannel message
516
516
// and on the requesting node's public key that returns a bool which
@@ -520,7 +520,13 @@ type Config struct {
520
520
// NotifyPendingOpenChannelEvent informs the ChannelNotifier when
521
521
// channels enter a pending state.
522
522
NotifyPendingOpenChannelEvent func (wire.OutPoint ,
523
- * channeldb.OpenChannel )
523
+ * channeldb.OpenChannel , * btcec.PublicKey ) error
524
+
525
+ // NotifyFundingTimeout informs the ChannelNotifier when a pending-open
526
+ // channel times out because the funding transaction hasn't confirmed.
527
+ // This is only called for the fundee and only if the channel is
528
+ // zero-conf.
529
+ NotifyFundingTimeout func (wire.OutPoint , * btcec.PublicKey ) error
524
530
525
531
// EnableUpfrontShutdown specifies whether the upfront shutdown script
526
532
// is enabled.
@@ -1312,7 +1318,13 @@ func (f *Manager) advancePendingChannelState(channel *channeldb.OpenChannel,
1312
1318
1313
1319
// Inform the ChannelNotifier that the channel has transitioned
1314
1320
// from pending open to open.
1315
- f .cfg .NotifyOpenChannelEvent (channel .FundingOutpoint )
1321
+ if err := f .cfg .NotifyOpenChannelEvent (
1322
+ channel .FundingOutpoint , channel .IdentityPub ,
1323
+ ); err != nil {
1324
+ log .Errorf ("Unable to notify open channel event for " +
1325
+ "ChannelPoint(%v): %v" ,
1326
+ channel .FundingOutpoint , err )
1327
+ }
1316
1328
1317
1329
// Find and close the discoverySignal for this channel such
1318
1330
// that ChannelReady messages will be processed.
@@ -2653,7 +2665,12 @@ func (f *Manager) fundeeProcessFundingCreated(peer lnpeer.Peer,
2653
2665
2654
2666
// Inform the ChannelNotifier that the channel has entered
2655
2667
// pending open state.
2656
- f .cfg .NotifyPendingOpenChannelEvent (fundingOut , completeChan )
2668
+ if err := f .cfg .NotifyPendingOpenChannelEvent (
2669
+ fundingOut , completeChan , completeChan .IdentityPub ,
2670
+ ); err != nil {
2671
+ log .Errorf ("Unable to send pending-open channel event for " +
2672
+ "ChannelPoint(%v) %v" , fundingOut , err )
2673
+ }
2657
2674
2658
2675
// At this point we have sent our last funding message to the
2659
2676
// initiating peer before the funding transaction will be broadcast.
@@ -2873,7 +2890,14 @@ func (f *Manager) funderProcessFundingSigned(peer lnpeer.Peer,
2873
2890
case resCtx .updates <- upd :
2874
2891
// Inform the ChannelNotifier that the channel has entered
2875
2892
// pending open state.
2876
- f .cfg .NotifyPendingOpenChannelEvent (* fundingPoint , completeChan )
2893
+ if err := f .cfg .NotifyPendingOpenChannelEvent (
2894
+ * fundingPoint , completeChan , completeChan .IdentityPub ,
2895
+ ); err != nil {
2896
+ log .Errorf ("Unable to send pending-open channel " +
2897
+ "event for ChannelPoint(%v) %v" , fundingPoint ,
2898
+ err )
2899
+ }
2900
+
2877
2901
case <- f .quit :
2878
2902
return
2879
2903
}
@@ -2929,6 +2953,13 @@ func (f *Manager) fundingTimeout(c *channeldb.OpenChannel,
2929
2953
c .FundingOutpoint , err )
2930
2954
}
2931
2955
2956
+ // Notify other subsystems about the funding timeout.
2957
+ err := f .cfg .NotifyFundingTimeout (c .FundingOutpoint , c .IdentityPub )
2958
+ if err != nil {
2959
+ log .Errorf ("failed to notify of funding timeout for " +
2960
+ "ChanPoint(%v): %v" , c .FundingOutpoint , err )
2961
+ }
2962
+
2932
2963
timeoutErr := fmt .Errorf ("timeout waiting for funding tx (%v) to " +
2933
2964
"confirm" , c .FundingOutpoint )
2934
2965
@@ -3297,7 +3328,13 @@ func (f *Manager) handleFundingConfirmation(
3297
3328
3298
3329
// Inform the ChannelNotifier that the channel has transitioned from
3299
3330
// pending open to open.
3300
- f .cfg .NotifyOpenChannelEvent (completeChan .FundingOutpoint )
3331
+ if err := f .cfg .NotifyOpenChannelEvent (
3332
+ completeChan .FundingOutpoint , completeChan .IdentityPub ,
3333
+ ); err != nil {
3334
+ log .Errorf ("Unable to notify open channel event for " +
3335
+ "ChannelPoint(%v): %v" , completeChan .FundingOutpoint ,
3336
+ err )
3337
+ }
3301
3338
3302
3339
// Close the discoverySignal channel, indicating to a separate
3303
3340
// goroutine that the channel now is marked as open in the database
0 commit comments