diff --git a/fundingmanager.go b/fundingmanager.go index 2babcaad3..1eb45b65a 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -333,6 +333,10 @@ type fundingConfig struct { // flood us with very small channels that would never really be usable // due to fees. MinChanSize btcutil.Amount + + // NotifyOpenChannelEvent informs the ChannelNotifier when channels + // transition from pending open to open. + NotifyOpenChannelEvent func(wire.OutPoint) } // fundingManager acts as an orchestrator/bridge between the wallet's @@ -1939,6 +1943,10 @@ func (f *fundingManager) waitForFundingConfirmation(completeChan *channeldb.Open return } + // Inform the ChannelNotifier that the channel has transitioned from + // pending open to open. + f.cfg.NotifyOpenChannelEvent(completeChan.FundingOutpoint) + // TODO(roasbeef): ideally persistent state update for chan above // should be abstracted diff --git a/fundingmanager_test.go b/fundingmanager_test.go index 6231ff4dd..22d0d7109 100644 --- a/fundingmanager_test.go +++ b/fundingmanager_test.go @@ -353,8 +353,9 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey, publTxChan <- txn return nil }, - ZombieSweeperInterval: 1 * time.Hour, - ReservationTimeout: 1 * time.Nanosecond, + ZombieSweeperInterval: 1 * time.Hour, + ReservationTimeout: 1 * time.Nanosecond, + NotifyOpenChannelEvent: func(wire.OutPoint) {}, }) if err != nil { t.Fatalf("failed creating fundingManager: %v", err) diff --git a/server.go b/server.go index fa563762d..2d32239c2 100644 --- a/server.go +++ b/server.go @@ -927,9 +927,10 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl, // channel bandwidth. return uint16(input.MaxHTLCNumber / 2) }, - ZombieSweeperInterval: 1 * time.Minute, - ReservationTimeout: 10 * time.Minute, - MinChanSize: btcutil.Amount(cfg.MinChanSize), + ZombieSweeperInterval: 1 * time.Minute, + ReservationTimeout: 10 * time.Minute, + MinChanSize: btcutil.Amount(cfg.MinChanSize), + NotifyOpenChannelEvent: s.channelNotifier.NotifyOpenChannelEvent, }) if err != nil { return nil, err