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
|
// AuxResolver is an optional interface that can be used to modify the
|
||||||
// way contracts are resolved.
|
// way contracts are resolved.
|
||||||
AuxResolver fn.Option[lnwallet.AuxContractResolver]
|
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
|
// 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()
|
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
|
// If we are in development mode, we'll wait for specified duration
|
||||||
// before processing the channel ready message.
|
// before processing the channel ready message.
|
||||||
if f.cfg.Dev != nil {
|
if f.cfg.Dev != nil {
|
||||||
|
|||||||
@@ -1628,6 +1628,7 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
|||||||
AuxFundingController: implCfg.AuxFundingController,
|
AuxFundingController: implCfg.AuxFundingController,
|
||||||
AuxSigner: implCfg.AuxSigner,
|
AuxSigner: implCfg.AuxSigner,
|
||||||
AuxResolver: implCfg.AuxContractResolver,
|
AuxResolver: implCfg.AuxContractResolver,
|
||||||
|
AuxChannelNegotiator: implCfg.AuxChannelNegotiator,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in new issue
Block a user