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:
8 files changed
+44
-52
No files matched your search
@@ -206,9 +206,14 @@ func CreateTestChannels(tweaklessCommits bool) (
|
||||
}
|
||||
aliceCommitPoint := input.ComputeCommitmentPoint(aliceFirstRevoke[:])
|
||||
|
||||
chanType := channeldb.SingleFunderTweaklessBit
|
||||
if !tweaklessCommits {
|
||||
chanType = channeldb.SingleFunderBit
|
||||
}
|
||||
|
||||
aliceCommitTx, bobCommitTx, err := CreateCommitmentTxns(
|
||||
channelBal, channelBal, &aliceCfg, &bobCfg, aliceCommitPoint,
|
||||
bobCommitPoint, *fundingTxIn, tweaklessCommits,
|
||||
bobCommitPoint, *fundingTxIn, chanType,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
@@ -275,7 +280,7 @@ func CreateTestChannels(tweaklessCommits bool) (
|
||||
IdentityPub: aliceKeys[0].PubKey(),
|
||||
FundingOutpoint: *prevOut,
|
||||
ShortChannelID: shortChanID,
|
||||
ChanType: channeldb.SingleFunderTweaklessBit,
|
||||
ChanType: chanType,
|
||||
IsInitiator: true,
|
||||
Capacity: channelCapacity,
|
||||
RemoteCurrentRevocation: bobCommitPoint,
|
||||
@@ -293,7 +298,7 @@ func CreateTestChannels(tweaklessCommits bool) (
|
||||
IdentityPub: bobKeys[0].PubKey(),
|
||||
FundingOutpoint: *prevOut,
|
||||
ShortChannelID: shortChanID,
|
||||
ChanType: channeldb.SingleFunderTweaklessBit,
|
||||
ChanType: chanType,
|
||||
IsInitiator: false,
|
||||
Capacity: channelCapacity,
|
||||
RemoteCurrentRevocation: aliceCommitPoint,
|
||||
@@ -305,11 +310,6 @@ func CreateTestChannels(tweaklessCommits bool) (
|
||||
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||
}
|
||||
|
||||
if !tweaklessCommits {
|
||||
aliceChannelState.ChanType = channeldb.SingleFunderBit
|
||||
bobChannelState.ChanType = channeldb.SingleFunderBit
|
||||
}
|
||||
|
||||
aliceSigner := &input.MockSigner{Privkeys: aliceKeys}
|
||||
bobSigner := &input.MockSigner{Privkeys: bobKeys}
|
||||
|
||||
|
||||
Reference in new issue
Block a user