lnwallet: add WithAuxSigner option to channel
This commit is contained in:
1 parent
f52a163334
commit
1e85c5054e
1 file changed
+13
@@ -760,6 +760,10 @@ type LightningChannel struct {
|
|||||||
// signatures, of which there may be hundreds.
|
// signatures, of which there may be hundreds.
|
||||||
sigPool *SigPool
|
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 is the total capacity of this channel.
|
||||||
Capacity btcutil.Amount
|
Capacity btcutil.Amount
|
||||||
|
|
||||||
@@ -821,6 +825,7 @@ type channelOpts struct {
|
|||||||
remoteNonce *musig2.Nonces
|
remoteNonce *musig2.Nonces
|
||||||
|
|
||||||
leafStore fn.Option[AuxLeafStore]
|
leafStore fn.Option[AuxLeafStore]
|
||||||
|
auxSigner fn.Option[AuxSigner]
|
||||||
|
|
||||||
skipNonceInit bool
|
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.
|
// defaultChannelOpts returns the set of default options for a new channel.
|
||||||
func defaultChannelOpts() *channelOpts {
|
func defaultChannelOpts() *channelOpts {
|
||||||
return &channelOpts{}
|
return &channelOpts{}
|
||||||
@@ -911,6 +923,7 @@ func NewLightningChannel(signer input.Signer,
|
|||||||
lc := &LightningChannel{
|
lc := &LightningChannel{
|
||||||
Signer: signer,
|
Signer: signer,
|
||||||
leafStore: opts.leafStore,
|
leafStore: opts.leafStore,
|
||||||
|
auxSigner: opts.auxSigner,
|
||||||
sigPool: sigPool,
|
sigPool: sigPool,
|
||||||
currentHeight: localCommit.CommitHeight,
|
currentHeight: localCommit.CommitHeight,
|
||||||
commitChains: commitChains,
|
commitChains: commitChains,
|
||||||
|
|||||||
Reference in new issue
Block a user