funding: notify aux negotiator on ChannelReady
We notify the aux channel negotiator that an established channel is now ready to use.
This commit is contained in:
2 files changed
+14
No files matched your search
@@ -568,6 +568,11 @@ type Config struct {
|
||||
// AuxResolver is an optional interface that can be used to modify the
|
||||
// way contracts are resolved.
|
||||
AuxResolver fn.Option[lnwallet.AuxContractResolver]
|
||||
|
||||
// AuxChannelNegotiator is an optional interface that allows aux channel
|
||||
// implementations to inject and process custom records over channel
|
||||
// related wire messages.
|
||||
AuxChannelNegotiator fn.Option[lnwallet.AuxChannelNegotiator]
|
||||
}
|
||||
|
||||
// Manager acts as an orchestrator/bridge between the wallet's
|
||||
@@ -4019,6 +4024,14 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen
|
||||
|
||||
defer f.wg.Done()
|
||||
|
||||
// Notify the aux hook that the specified peer just established a
|
||||
// channel with us, identified by the given channel ID.
|
||||
f.cfg.AuxChannelNegotiator.WhenSome(
|
||||
func(acn lnwallet.AuxChannelNegotiator) {
|
||||
acn.ProcessChannelReady(msg.ChanID, peer.PubKey())
|
||||
},
|
||||
)
|
||||
|
||||
// If we are in development mode, we'll wait for specified duration
|
||||
// before processing the channel ready message.
|
||||
if f.cfg.Dev != nil {
|
||||
|
||||
@@ -1628,6 +1628,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
||||
AuxFundingController: implCfg.AuxFundingController,
|
||||
AuxSigner: implCfg.AuxSigner,
|
||||
AuxResolver: implCfg.AuxContractResolver,
|
||||
AuxChannelNegotiator: implCfg.AuxChannelNegotiator,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user