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
|
// flood us with very small channels that would never really be usable
|
||||||
// due to fees.
|
// due to fees.
|
||||||
MinChanSize btcutil.Amount
|
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
|
// fundingManager acts as an orchestrator/bridge between the wallet's
|
||||||
@ -1939,6 +1943,10 @@ func (f *fundingManager) waitForFundingConfirmation(completeChan *channeldb.Open
|
|||||||
return
|
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
|
// TODO(roasbeef): ideally persistent state update for chan above
|
||||||
// should be abstracted
|
// should be abstracted
|
||||||
|
|
||||||
|
@ -355,6 +355,7 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
|||||||
},
|
},
|
||||||
ZombieSweeperInterval: 1 * time.Hour,
|
ZombieSweeperInterval: 1 * time.Hour,
|
||||||
ReservationTimeout: 1 * time.Nanosecond,
|
ReservationTimeout: 1 * time.Nanosecond,
|
||||||
|
NotifyOpenChannelEvent: func(wire.OutPoint) {},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed creating fundingManager: %v", err)
|
t.Fatalf("failed creating fundingManager: %v", err)
|
||||||
|
@ -930,6 +930,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
|
|||||||
ZombieSweeperInterval: 1 * time.Minute,
|
ZombieSweeperInterval: 1 * time.Minute,
|
||||||
ReservationTimeout: 10 * time.Minute,
|
ReservationTimeout: 10 * time.Minute,
|
||||||
MinChanSize: btcutil.Amount(cfg.MinChanSize),
|
MinChanSize: btcutil.Amount(cfg.MinChanSize),
|
||||||
|
NotifyOpenChannelEvent: s.channelNotifier.NotifyOpenChannelEvent,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user