Skip to content

Commit

Permalink
lnwallet: add WithAuxSigner option to channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef authored and guggero committed May 21, 2024
1 parent 1763bfd commit 26e1a0c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,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

Expand Down Expand Up @@ -1441,6 +1445,7 @@ type channelOpts struct {
remoteNonce *musig2.Nonces

leafStore fn.Option[AuxLeafStore]
auxSigner fn.Option[AuxSigner]

skipNonceInit bool
}
Expand Down Expand Up @@ -1479,6 +1484,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{}
Expand Down Expand Up @@ -1522,6 +1534,7 @@ func NewLightningChannel(signer input.Signer,
lc := &LightningChannel{
Signer: signer,
leafStore: opts.leafStore,
auxSigner: opts.auxSigner,
sigPool: sigPool,
currentHeight: localCommit.CommitHeight,
remoteCommitChain: newCommitmentChain(),
Expand Down

0 comments on commit 26e1a0c

Please sign in to comment.