-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9072 from lightningnetwork/extract-part3-from-sta…
…ging-branch [custom channels 3/5]: Extract PART3 from mega staging branch
- Loading branch information
Showing
40 changed files
with
1,926 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package funding | ||
|
||
import ( | ||
"github.com/btcsuite/btcd/chaincfg/chainhash" | ||
"github.com/lightningnetwork/lnd/fn" | ||
"github.com/lightningnetwork/lnd/lntypes" | ||
"github.com/lightningnetwork/lnd/lnwallet" | ||
"github.com/lightningnetwork/lnd/msgmux" | ||
) | ||
|
||
// AuxFundingDescResult is a type alias for a function that returns an optional | ||
// aux funding desc. | ||
type AuxFundingDescResult = fn.Result[fn.Option[lnwallet.AuxFundingDesc]] | ||
|
||
// AuxTapscriptResult is a type alias for a function that returns an optional | ||
// tapscript root. | ||
type AuxTapscriptResult = fn.Result[fn.Option[chainhash.Hash]] | ||
|
||
// AuxFundingController permits the implementation of the funding of custom | ||
// channels types. The controller serves as a MsgEndpoint which allows it to | ||
// intercept custom messages, or even the regular funding messages. The | ||
// controller might also pass along an aux funding desc based on an existing | ||
// pending channel ID. | ||
type AuxFundingController interface { | ||
// Endpoint is the embedded interface that signals that the funding | ||
// controller is also a message endpoint. This'll allow it to handle | ||
// custom messages specific to the funding type. | ||
msgmux.Endpoint | ||
|
||
// DescFromPendingChanID takes a pending channel ID, that may already be | ||
// known due to prior custom channel messages, and maybe returns an aux | ||
// funding desc which can be used to modify how a channel is funded. | ||
DescFromPendingChanID(pid PendingChanID, openChan lnwallet.AuxChanState, | ||
keyRing lntypes.Dual[lnwallet.CommitmentKeyRing], | ||
initiator bool) AuxFundingDescResult | ||
|
||
// DeriveTapscriptRoot takes a pending channel ID and maybe returns a | ||
// tapscript root that should be used when creating any MuSig2 sessions | ||
// for a channel. | ||
DeriveTapscriptRoot(PendingChanID) AuxTapscriptResult | ||
|
||
// ChannelReady is called when a channel has been fully opened (multiple | ||
// confirmations) and is ready to be used. This can be used to perform | ||
// any final setup or cleanup. | ||
ChannelReady(openChan lnwallet.AuxChanState) error | ||
|
||
// ChannelFinalized is called when a channel has been fully finalized. | ||
// In this state, we've received the commitment sig from the remote | ||
// party, so we are safe to broadcast the funding transaction. | ||
ChannelFinalized(PendingChanID) error | ||
} |
Oops, something went wrong.