lnwallet: pass chan cfgs to CreateCommitTx

Instead of passing delays and dustlimits separately, we pass the correct
channel config to CreateCommitTx from the POV of the local party that
owns the commit tx.

To make it more clear which commitment we are actually creating, we
rename variables to denote local and remote, to prepare for the case
when both outputs might be delayed.
This commit is contained in:
Johan T. Halseth committed 2020-01-06 11:42:03 +01:00
1 parent 1a4f81ed90
commit fff9dbe6f3
3 files changed
+70 -43

No files matched your search

+8 -6
View File
@@ -784,9 +784,10 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
theirChanCfg,
)
ourCommitTx, err := CreateCommitTx(fundingTxIn, localCommitmentKeys,
uint32(ourChanCfg.CsvDelay), localBalance, remoteBalance,
ourChanCfg.DustLimit)
ourCommitTx, err := CreateCommitTx(
fundingTxIn, localCommitmentKeys, ourChanCfg, theirChanCfg,
localBalance, remoteBalance,
)
if err != nil {
return nil, nil, err
}
@@ -796,9 +797,10 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
return nil, nil, err
}
theirCommitTx, err := CreateCommitTx(fundingTxIn, remoteCommitmentKeys,
uint32(theirChanCfg.CsvDelay), remoteBalance, localBalance,
theirChanCfg.DustLimit)
theirCommitTx, err := CreateCommitTx(
fundingTxIn, remoteCommitmentKeys, theirChanCfg, ourChanCfg,
remoteBalance, localBalance,
)
if err != nil {
return nil, nil, err
}