lnwallet: support transactions and scripts for new commitment type

This commit modifies the channel state machine to be able to derive the
proper commitment and second-level HTLC output scripts required by the
new script-enforced leased channel commitment type.
This commit is contained in:
Wilmer Paulino
2021-07-14 17:16:13 -07:00
committed by Olaoluwa Osuntokun
parent 01e9bb2bff
commit 8cfb53f64a
11 changed files with 230 additions and 98 deletions

View File

@@ -119,6 +119,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
channelBal := channelCapacity / 2
csvTimeoutAlice := uint32(5)
csvTimeoutBob := uint32(4)
isAliceInitiator := true
prevOut := &wire.OutPoint{
Hash: chainhash.Hash(testHdSeed),
@@ -223,7 +224,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
aliceCommitTx, bobCommitTx, err := CreateCommitmentTxns(
channelBal, channelBal, &aliceCfg, &bobCfg, aliceCommitPoint,
bobCommitPoint, *fundingTxIn, chanType,
bobCommitPoint, *fundingTxIn, chanType, isAliceInitiator, 0,
)
if err != nil {
return nil, nil, nil, err
@@ -318,7 +319,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
FundingOutpoint: *prevOut,
ShortChannelID: shortChanID,
ChanType: chanType,
IsInitiator: true,
IsInitiator: isAliceInitiator,
Capacity: channelCapacity,
RemoteCurrentRevocation: bobCommitPoint,
RevocationProducer: alicePreimageProducer,
@@ -336,7 +337,7 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
FundingOutpoint: *prevOut,
ShortChannelID: shortChanID,
ChanType: chanType,
IsInitiator: false,
IsInitiator: !isAliceInitiator,
Capacity: channelCapacity,
RemoteCurrentRevocation: aliceCommitPoint,
RevocationProducer: bobPreimageProducer,