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:
George Tsagkarelis
2025-09-01 16:41:13 +02:00
parent be4134553f
commit a58a52ee35
2 changed files with 14 additions and 0 deletions

View File

@@ -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 {