lnwallet: add WithAuxSigner option to channel

This commit is contained in:
Olaoluwa Osuntokun 2024-04-08 19:47:26 -07:00 committed by Oliver Gugger
parent 6d3f8af007
commit b83783cc3d
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

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,