lnwallet: add WithAuxSigner option to channel

This commit is contained in:
Olaoluwa Osuntokun authored and Oliver Gugger committed 2024-09-18 10:25:42 +02:00
1 parent f52a163334
commit 1e85c5054e
1 file changed
+13
+13
View File
@@ -760,6 +760,10 @@ type LightningChannel struct {
// signatures, of which there may be hundreds.
sigPool *SigPool
// auxSigner is a special signer used to obtain opaque signatures for
// custom channel variants.
auxSigner fn.Option[AuxSigner]
// Capacity is the total capacity of this channel.
Capacity btcutil.Amount
@@ -821,6 +825,7 @@ type channelOpts struct {
remoteNonce *musig2.Nonces
leafStore fn.Option[AuxLeafStore]
auxSigner fn.Option[AuxSigner]
skipNonceInit bool
}
@@ -859,6 +864,13 @@ func WithLeafStore(store AuxLeafStore) ChannelOpt {
}
}
// WithAuxSigner is used to specify a custom aux signer for the channel.
func WithAuxSigner(signer AuxSigner) ChannelOpt {
return func(o *channelOpts) {
o.auxSigner = fn.Some[AuxSigner](signer)
}
}
// defaultChannelOpts returns the set of default options for a new channel.
func defaultChannelOpts() *channelOpts {
return &channelOpts{}
@@ -911,6 +923,7 @@ func NewLightningChannel(signer input.Signer,
lc := &LightningChannel{
Signer: signer,
leafStore: opts.leafStore,
auxSigner: opts.auxSigner,
sigPool: sigPool,
currentHeight: localCommit.CommitHeight,
commitChains: commitChains,