fundingmanager: inform ChannelNotifier about newly open channels.
This commit is contained in:
parent
cb26fd8a17
commit
5405028948
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user