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 authored and Olaoluwa Osuntokun committed 2021-10-19 18:30:32 -07:00
1 parent 01e9bb2bff
commit 8cfb53f64a
11 files changed
+230 -98

No files matched your search

+4 -2
View File
@@ -79,6 +79,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
bobDustLimit := btcutil.Amount(1300)
csvTimeoutAlice := uint32(5)
csvTimeoutBob := uint32(4)
isAliceInitiator := true
prevOut := &wire.OutPoint{
Hash: channels.TestHdSeed,
@@ -162,6 +163,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
aliceCommitTx, bobCommitTx, err := lnwallet.CreateCommitmentTxns(
channelBal, channelBal, &aliceCfg, &bobCfg, aliceCommitPoint,
bobCommitPoint, *fundingTxIn, channeldb.SingleFunderTweaklessBit,
isAliceInitiator, 0,
)
if err != nil {
return nil, nil, nil, err
@@ -229,7 +231,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
FundingOutpoint: *prevOut,
ShortChannelID: shortChanID,
ChanType: channeldb.SingleFunderTweaklessBit,
IsInitiator: true,
IsInitiator: isAliceInitiator,
Capacity: channelCapacity,
RemoteCurrentRevocation: bobCommitPoint,
RevocationProducer: alicePreimageProducer,
@@ -246,7 +248,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
IdentityPub: bobKeyPub,
FundingOutpoint: *prevOut,
ChanType: channeldb.SingleFunderTweaklessBit,
IsInitiator: false,
IsInitiator: !isAliceInitiator,
Capacity: channelCapacity,
RemoteCurrentRevocation: aliceCommitPoint,
RevocationProducer: bobPreimageProducer,