mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-18 06:34:27 +01:00
lnwallet: use channel type to derive keys
We abstract away how keys are generated for the different channel types types (currently tweak(less)). Intention is that more of the logic that is unique for each commitment type lives in commitment.go, making the channel state machine oblivious to the keys and outputs being created on the commitment tx for a given channel state.
This commit is contained in:
@@ -86,13 +86,16 @@ type CommitmentKeyRing struct {
|
||||
RevocationKey *btcec.PublicKey
|
||||
}
|
||||
|
||||
// DeriveCommitmentKey generates a new commitment key set using the base points
|
||||
// and commitment point. The keys are derived differently depending whether the
|
||||
// commitment transaction is ours or the remote peer's.
|
||||
// DeriveCommitmentKeys generates a new commitment key set using the base points
|
||||
// and commitment point. The keys are derived differently depending on the type
|
||||
// of channel, and whether the commitment transaction is ours or the remote
|
||||
// peer's.
|
||||
func DeriveCommitmentKeys(commitPoint *btcec.PublicKey,
|
||||
isOurCommit, tweaklessCommit bool,
|
||||
isOurCommit bool, chanType channeldb.ChannelType,
|
||||
localChanCfg, remoteChanCfg *channeldb.ChannelConfig) *CommitmentKeyRing {
|
||||
|
||||
tweaklessCommit := chanType.IsTweakless()
|
||||
|
||||
// First, we'll derive all the keys that don't depend on the context of
|
||||
// whose commitment transaction this is.
|
||||
keyRing := &CommitmentKeyRing{
|
||||
|
||||
Reference in New Issue
Block a user